#author("2018-12-08T22:31:53+09:00","","") #navi(../) * PowerShellのベル音(Beep)を消す方法 [#ha1bb302] Windows10で文字がない状態で、BS(Backspace)キーを押すと、「ピー!」と音が鳴る方は、~ この手順で音を止めることができます。~ #ref(00.png) #contents #htmlinsertpcsp(win-top.html,win-sp.html) * 関連サイト [#ycd7530c] Microsoft Docs~ -[[Windows PowerShell SDK 1.1.0 BellStyle Enum>https://docs.microsoft.com/en-us/dotnet/api/microsoft.powershell.bellstyle?view=powershellsdk-1.1.0]]~ Microsoft PowerShell 5.1 -[[Set-PSReadlineOption>https://docs.microsoft.com/en-us/powershell/module/psreadline/set-psreadlineoption?view=powershell-5.1]] * 関連記事 [#x493cd10] -[[PowerShellコンソール起動時にスクリプトを実行する方法>PowerShell/PowerShellコンソール起動時にスクリプトを実行する方法]] * PowerShellのバージョン [#g244fbca] 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 * PSReadlineOptionのBellStyle [#i34f122b] PSReadlineのBellStyleがVisibleの場合、何も文字がないところでBSキーを押すと、~ ベル音がなってしまいます。 [[Set-PSReadlineOption>https://docs.microsoft.com/en-us/powershell/module/psreadline/set-psreadlineoption?view=powershell-5.1]] の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する [#d9a8c473] 上記の抜粋の通り、BellStyleに''None''を指定すれば、ベル音は出なくなります。~ 構文は以下の通りです。 Set-PSReadlineOption -BellStyle None 本設定をPowerShellコンソールを起動したときに、自動実行したい場合は、$PROFILE変数が示すファイルに~ 上記コマンド構文を追記すればよいでしょう。~ 起動時に実行するスクリプト($PROFILE)については、以下のリンク先記事を参考にしてください。 -[[PowerShellコンソール起動時にスクリプトを実行する方法>PowerShell/PowerShellコンソール起動時にスクリプトを実行する方法]] 以上、PowerShellのベル音を止める方法でした。 #htmlinsertpcsp(win-btm.html,win-sp.html)