このエントリーをはてなブックマークに追加


PowerShellのベル音(Beep)を消す方法

Windows10で文字がない状態で、BS(Backspace)キーを押すと、「ピー!」と音が鳴る方は、
この手順で音を止めることができます。

00.png

関連サイト

関連記事

PowerShellのバージョン

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

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する

上記の抜粋の通り、BellStyleにNoneを指定すれば、ベル音は出なくなります。
構文は以下の通りです。

Set-PSReadlineOption -BellStyle None

本設定をPowerShellコンソールを起動したときに、自動実行したい場合は、$PROFILE変数が示すファイルに
上記コマンド構文を追記すればよいでしょう。
起動時に実行するスクリプト($PROFILE)については、以下のリンク先記事を参考にしてください。

以上、PowerShellのベル音を止める方法でした。



添付ファイル: file00.png 585件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2018-12-08 (土) 22:35:58