如何在 PowerShell 中禁用恼人的哔哔声

NoS*_*tAl 6 powershell

有时我运行 grep(又名选择字符串),它的字符串经常出现,然后 PowerShell 会发疯,有时我设法用 Ctrl+C 杀死它,但即便如此,我也不得不忍受 30 秒以上的刺激性哔哔声。 . 是否可以在不杀死正在运行的终端的情况下禁用它?

小智 6

打开您的 PowerShell 配置文件,或键入:

if (!(Test-Path $profile)) {New-Item -Type File -Path $profile -Force}
Run Code Online (Sandbox Code Playgroud)

如果一个配置文件不存在,则创建一个配置文件。

然后添加Set-PSReadlineOption -BellStyle None到配置文件以关闭声音。

(那个声音让我的狗发疯,它正在削弱我的生存意志)


小智 2

这个 powershell 相当于已经回答过的 SC。

Get-Service Beep | Stop-Service -PassThru | Set-Service -StartupType Disabled
Run Code Online (Sandbox Code Playgroud)