Windows10で文字がない状態で、BS(Backspace)キーを押すと、「ピー!」と音が鳴る方は、
この手順で音を止めることができます。
Microsoft Docs
PS C:\> $PSVersionTable Name Value ---- ----- PSVersion 5.1.17134.407 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17134.407 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
PSReadlineのBellStyleがVisibleの場合、何も文字がないところでBSキーを押すと、
ベル音がなってしまいます。
Set-PSReadlineOption のBellStyleは以下のようになっています。
(抜粋)
-BellStyle Specifies how PSReadLine responds to various error conditions or user prompts. If you do not specify this parameter, the default response is Audible. The acceptable values for this parameter are: - None. No feedback. - Visual. Text flashes briefly. - Audible. A short beep.
初期値では以下のように Audible となっていました。
PS C:\> (Get-PSReadlineOption).BellStyle Audible
上記の抜粋の通り、BellStyleにNoneを指定すれば、ベル音は出なくなります。
構文は以下の通りです。
Set-PSReadlineOption -BellStyle None
本設定をPowerShellコンソールを起動したときに、自動実行したい場合は、$PROFILE変数が示すファイルに
上記コマンド構文を追記すればよいでしょう。
起動時に実行するスクリプト($PROFILE)については、以下のリンク先記事を参考にしてください。
以上、PowerShellのベル音を止める方法でした。