此警告在Visual应用程序的终端中不断弹出。
Warning: PowerShell detected that you might be using a screen reader and has
disabled PSReadLine for compatibility purposes.
If you want to re-enable it, run 'Import-Module PSReadLine'.即使我通过regedit将值更改为0,警告仍然显示。
发布于 2021-03-22 16:12:18
你的症状的含义是:
- By contrast, if you use Visual Studio Code _with the_ [_PowerShell extension_](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell), which enables a much richer PowerShell code-authoring experience, the problem doesn't occur, because the sessions provided by the extension in the so-called [_PowerShell Integrated Console_](https://stackoverflow.com/a/60132705/45375) do _not_ perform this check (as of version `2021.2.2`), and therefore _do_ load [`PSReadLine`](https://github.com/PowerShell/PSReadLine) (the module providing a rich command-line editing experience) and do not emit a warning. It is unclear if this unconditional override is by design or an oversight.- While you _could_ follow the advice in the error message and addImport-Module PSReadLine到您的$PROFILE文件并这样做将重新启用PSReadLine以获得丰富的命令行编辑体验,但是在启动时仍然会看到警告,因为在加载$PROFILE文件之前是由PowerShell发出的。尽管如此,如果在您的系统上通过设计启用屏幕阅读器模式,这是正确的解决方案。
如果此模式(意外地)通过persistently,注册中心()打开,则可以按以下方式关闭该模式:
Set-ItemProperty 'registry::HKEY_CURRENT_USER\Control Panel\Accessibility\Blind Access' On 0Note
Get-ItemPropertyValue 'registry::HKEY_CURRENT_USER\Control Panel\Accessibility\Blind Access' On如果此模式被某个应用程序意外地打开了in-OS-session,,因为该应用程序没有再次关闭该模式,或者在能够这样做之前已经崩溃,则可以临时编译C#代码来关闭该模式(感谢地从这个GitHub评论中修改),以便在同一OS用户会话中的未来 PowerShell会话不再看到警告。
(Add-Type -PassThru -Name ScreenReaderUtil -Namespace WinApiHelper -MemberDefinition @'
const int SPIF_SENDCHANGE = 0x0002;
const int SPI_SETSCREENREADER = 0x0047;
[DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);
public static void EnableScreenReader(bool enable)
{
var ok = SystemParametersInfo(SPI_SETSCREENREADER, enable ? 1u : 0u, IntPtr.Zero, SPIF_SENDCHANGE);
if (!ok)
{
throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());
}
}
'@)::EnableScreenReader($false)发布于 2022-10-31 14:23:34
你也可以试试这个(刚为我做的)
步骤1:打开"RUN“(WIN + R)步骤2:键入"regedit”步骤3:左侧有一个名为"HKEY_CURRENT_USER“的文件夹,单击第4步:单击名为的子文件夹”控制面板“,然后单击名为”盲访问“的子文件夹或遵循此路径
步骤5:右键单击选项" on ",选择“修改”选项,然后设置值0。
现在重启您的计算机和问题解决了:)
https://stackoverflow.com/questions/66748513
复制相似问题