ISEOptions オブジェクト
ISEOptions オブジェクトは、Windows PowerShell ISE のさまざまな設定を表します。 これは、Microsoft.PowerShell.Host.ISE.ISEOptions クラスのインスタンスです。
ISEOptions オブジェクトには、次のメソッドとプロパティが用意されています。
メソッド
RestoreDefaultConsoleTokenColors()
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
コンソール ウィンドウでトークンの色の既定値を復元します。
# Changes the color of the commands in the Console pane to red and then restores it to its default value.
$psISE.Options.ConsoleTokenColors["Command"] = 'red'
$psISE.Options.RestoreDefaultConsoleTokenColors()
RestoreDefaults()
Windows PowerShell ISE 2.0 以降でサポートされています。
コンソール ウィンドウのすべてのオプション設定の既定値を復元します。 また、標準のチェック ボックスを提供するさまざまな警告メッセージの動作をリセットして、メッセージが再び表示されないようにします。
# Changes the background color in the Console pane and then restores it to its default value.
$psISE.Options.ConsolePaneBackgroundColor = 'orange'
$psISE.Options.RestoreDefaults()
RestoreDefaultTokenColors()
Windows PowerShell ISE 2.0 以降でサポートされています。
[スクリプト] ウィンドウでトークンの色の既定値を復元します。
# Changes the color of the comments in the Script pane to red and then restores it to its default value.
$psISE.Options.TokenColors["Comment"] = 'red'
$psISE.Options.RestoreDefaultTokenColors()
RestoreDefaultXmlTokenColors()
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
Windows PowerShell ISE に表示される XML 要素のトークン の色の既定値を復元します。 XmlTokenColorsも参照してください。
# Changes the color of the comments in XML data to red and then restores it to its default value.
$psISE.Options.XmlTokenColors["Comment"] = 'red'
$psISE.Options.RestoreDefaultXmlTokenColors()
プロパティ
AutoSaveMinuteInterval
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
Windows PowerShell ISE によるファイルの自動保存操作の間隔を分単位で指定します。 既定値は 2 分です。 値は整数です。
# Changes the number of minutes between automatic save operations to every 3 minutes.
$psISE.Options.AutoSaveMinuteInterval = 3
CommandPaneBackgroundColor
この機能は Windows PowerShell ISE 2.0 に存在しますが、ISE の新しいバージョンでは削除または名前変更されました。 以降のバージョンについては、ConsolePaneBackgroundColor を参照してください。
コマンド ウィンドウの背景色を指定します。 System.Windows.Media.Color クラスのインスタンスです。
# Changes the background color of the Command pane to orange.
$psISE.Options.CommandPaneBackgroundColor = 'orange'
CommandPaneUp
この機能は Windows PowerShell ISE 2.0 に存在しますが、ISE の新しいバージョンでは削除または名前変更されました。
コマンド ウィンドウを出力ウィンドウの上に配置するかどうかを指定します。
# Moves the Command pane to the top of the screen.
$psISE.Options.CommandPaneUp = $true
ConsolePaneBackgroundColor
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
コンソール ウィンドウの背景色を指定します。 System.Windows.Media.Color クラスのインスタンスです。
# Changes the background color of the Console pane to red.
$psISE.Options.ConsolePaneBackgroundColor = 'red'
ConsolePaneForegroundColor
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
コンソール ウィンドウのテキストの前景色を指定します。
# Changes the foreground color of the text in the Console pane to yellow.
$psISE.Options.ConsolePaneForegroundColor = 'yellow'
ConsolePaneTextBackgroundColor
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
コンソール ウィンドウのテキストの背景色を指定します。
# Changes the background color of the Console pane text to pink.
$psISE.Options.ConsolePaneTextBackgroundColor = 'pink'
ConsoleTokenColors
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
Windows PowerShell ISE コンソール ウィンドウの IntelliSense トークンの色を指定します。 このプロパティは、コンソール ウィンドウのトークン型と色の名前と値のペアを含むディクショナリ オブジェクトです。 [スクリプト] ウィンドウで IntelliSense トークンの色を変更するには、「TokenColors」を参照してください。 色を既定値にリセットするには、「RestoreDefaultConsoleTokenColors を参照してください。 トークンの色は、属性、Command、CommandArgument、CommandParameter、Comment、GroupEnd、GroupStart、Keyword、LineContinuation、LoopLabel、Member、NewLine、Number、Operator、Position、StatementSeparator、String、Type、Unknown、Variable に設定できます。
# Sets the color of commands to green.
$psISE.Options.ConsoleTokenColors["Command"] = 'green'
# Sets the color of keywords to magenta.
$psISE.Options.ConsoleTokenColors["Keyword"] = 'magenta'
DebugBackgroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
コンソール ウィンドウに表示されるデバッグ テキストの背景色を指定します。 System.Windows.Media.Color クラスのインスタンスです。
# Changes the background color for the debug text that appears in the Console pane to blue.
$psISE.Options.DebugBackgroundColor = '#0000FF'
DebugForegroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
コンソール ウィンドウに表示されるデバッグ テキストの前景色を指定します。 System.Windows.Media.Color クラスのインスタンスです。
# Changes the foreground color for the debug text that appears in the Console pane to yellow.
$psISE.Options.DebugForegroundColor = 'yellow'
DefaultOptions
Windows PowerShell ISE 2.0 以降でサポートされています。
Reset メソッドを使用するときに使用する既定値を指定するプロパティのコレクション。
# Displays the name of the default options. This example is from ISE 4.0.
$psISE.Options.DefaultOptions
SelectedScriptPaneState : Top
ShowDefaultSnippets : True
ShowToolBar : True
ShowOutlining : True
ShowLineNumbers : True
TokenColors : {[Attribute, #FF00BFFF], [Command, #FF0000FF], [CommandArgument, #FF8A2BE2], [CommandParameter, #FF000080]...}
ConsoleTokenColors : {[Attribute, #FFB0C4DE], [Command, #FFE0FFFF], [CommandArgument, #FFEE82EE], [CommandParameter, #FFFFE4B5]...}
XmlTokenColors : {[Comment, #FF006400], [CommentDelimiter, #FF008000], [ElementName, #FF8B0000], [MarkupExtension, #FFFF8C00]...}
DefaultOptions : Microsoft.PowerShell.Host.ISE.ISEOptions
FontSize : 9
Zoom : 100
FontName : Lucida Console
ErrorForegroundColor : #FFFF0000
ErrorBackgroundColor : #00FFFFFF
WarningForegroundColor : #FFFF8C00
WarningBackgroundColor : #00FFFFFF
VerboseForegroundColor : #FF00FFFF
VerboseBackgroundColor : #00FFFFFF
DebugForegroundColor : #FF00FFFF
DebugBackgroundColor : #00FFFFFF
ConsolePaneBackgroundColor : #FF012456
ConsolePaneTextBackgroundColor : #FF012456
ConsolePaneForegroundColor : #FFF5F5F5
ScriptPaneBackgroundColor : #FFFFFFFF
ScriptPaneForegroundColor : #FF000000
ShowWarningForDuplicateFiles : True
ShowWarningBeforeSavingOnRun : True
UseLocalHelp : True
AutoSaveMinuteInterval : 2
MruCount : 10
ShowIntellisenseInConsolePane : True
ShowIntellisenseInScriptPane : True
UseEnterToSelectInConsolePaneIntellisense : True
UseEnterToSelectInScriptPaneIntellisense : True
IntellisenseTimeoutInSeconds : 3
ErrorBackgroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
コンソール ウィンドウに表示されるエラー テキストの背景色を指定します。 System.Windows.Media.Color クラスのインスタンスです。
# Changes the background color for the error text that appears in the Console pane to black.
$psISE.Options.ErrorBackgroundColor = 'black'
ErrorForegroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
コンソール ウィンドウに表示されるエラー テキストの前景色を指定します。 System.Windows.Media.Color クラスのインスタンスです。
# Changes the foreground color for the error text that appears in the console pane to green.
$psISE.Options.ErrorForegroundColor = 'green'
FontName
Windows PowerShell ISE 2.0 以降でサポートされています。
スクリプト ウィンドウとコンソール ウィンドウの両方で現在使用されているフォント名を指定します。
# Changes the font used in both panes.
$psISE.Options.FontName = 'Courier New'
FontSize
Windows PowerShell ISE 2.0 以降でサポートされています。
フォント サイズを整数で指定します。 スクリプト ペイン、コマンド ペイン、および出力ペインで使用されます。 有効な値の範囲は 8 ~ 32 です。
# Changes the font size in all panes.
$psISE.Options.FontSize = 20
IntellisenseTimeoutInSeconds
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
IntelliSense が現在入力されているテキストの解決に使用する秒数を指定します。 この秒数が経過すると、IntelliSense はタイムアウトになり、入力を続けることができます。 既定値は 3 秒です。 値は整数です。
# Changes the number of seconds for IntelliSense syntax recognition to 5.
$psISE.Options.IntellisenseTimeoutInSeconds = 5
MruCount
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
Windows PowerShell ISE で最近開いたファイルの数を指定します。このファイルは、[ファイルを開く] メニューの下部 表示されます。 既定値は 10 です。 値は整数です。
# Changes the number of recently used files that appear at the bottom of the File Open menu to 5.
$psISE.Options.MruCount = 5
OutputPaneBackgroundColor
この機能は Windows PowerShell ISE 2.0 に存在しますが、ISE の新しいバージョンでは削除または名前変更されました。 以降のバージョンについては、ConsolePaneBackgroundColor を参照してください。
出力ウィンドウ自体の背景色を取得または設定する読み取り/書き込みプロパティ。 System.Windows.Media.Color クラスのインスタンスです。
# Changes the background color of the Output pane to gold.
$psISE.Options.OutputPaneForegroundColor = 'gold'
OutputPaneTextForegroundColor
この機能は Windows PowerShell ISE 2.0 に存在しますが、ISE の新しいバージョンでは削除または名前変更されました。 以降のバージョンについては、ConsolePaneForegroundColor を参照してください。
Windows PowerShell ISE 2.0 の [出力] ウィンドウのテキストの前景色を変更する読み取り/書き込みプロパティ。
# Changes the foreground color of the text in the Output Pane to blue.
$psISE.Options.OutputPaneTextForegroundColor = 'blue'
OutputPaneTextBackgroundColor
この機能は Windows PowerShell ISE 2.0 に存在しますが、ISE の新しいバージョンでは削除または名前変更されました。 以降のバージョンについては、ConsolePaneTextBackgroundColor を参照してください。
出力ペインのテキストの背景色を変更する読み取り/書き込みプロパティ。
# Changes the background color of the Output pane text to pink.
$psISE.Options.OutputPaneTextBackgroundColor = 'pink'
ScriptPaneBackgroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
ファイルの背景色を取得または設定する読み取り/書き込みプロパティ。 System.Windows.Media.Color クラスのインスタンスです。
# Sets the color of the script pane background to yellow.
$psISE.Options.ScriptPaneBackgroundColor = 'yellow'
ScriptPaneForegroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
スクリプト ペイン内のスクリプト以外のファイルの前景色を取得または設定する読み取り/書き込みプロパティ。 スクリプト ファイルの前景色を設定するには、TokenColorsを使用します。
# Sets the foreground to color of non-script files in the script pane to green.
$psISE.Options.ScriptPaneBackgroundColor = 'green'
SelectedScriptPaneState
Windows PowerShell ISE 2.0 以降でサポートされています。
ディスプレイ上のスクリプト ペインの位置を取得または設定する読み取り/書き込みプロパティ。 文字列には、'Maximized'、'Top'、または 'Right' のいずれかを指定できます。
# Moves the Script Pane to the top.
$psISE.Options.SelectedScriptPaneState = 'Top'
# Moves the Script Pane to the right.
$psISE.Options.SelectedScriptPaneState = 'Right'
# Maximizes the Script Pane
$psISE.Options.SelectedScriptPaneState = 'Maximized'
ShowDefaultSnippets
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
スニペットの Ctrl+J リストに、Windows PowerShell に含まれるスターター セットを含めるかどうかを指定します。
$false
に設定すると、ユーザー定義スニペットのみが Ctrl+J リストに表示されます。
既定値は $true
です。
# Hide the default snippets from the CTRL+J list.
$psISE.Options.ShowDefaultSnippets = $false
ShowIntellisenseInConsolePane
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
IntelliSense がコンソール ウィンドウで構文、パラメーター、および値の候補を提供するかどうかを指定します。
既定値は $true
です。
# Turn off IntelliSense in the console pane.
$psISE.Options.ShowIntellisenseInConsolePane = $false
ShowIntellisenseInScriptPane
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
IntelliSense がスクリプト ペインで構文、パラメーター、および値の候補を提供するかどうかを指定します。
既定値は $true
です。
# Turn off IntelliSense in the Script pane.
$psISE.Options.ShowIntellisenseInScriptPane = $false
ShowLineNumbers
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
[スクリプト] ウィンドウで左余白に行番号を表示するかどうかを指定します。 既定値は $true
です。
# Turn off line numbers in the Script pane.
$psISE.Options.ShowLineNumbers = $false
ShowOutlining
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
[スクリプト] ウィンドウで、左余白のコードセクションの横に展開可能な角かっこと折りたたみ可能な角かっこを表示するかどうかを指定します。 表示されたら、テキストブロックの横にあるマイナス -
アイコンをクリックして折りたたんだり、プラス +
アイコンをクリックしてテキストブロックを展開したりできます。 既定値は $true
です。
# Turn off outlining in the Script pane.
$psISE.Options.ShowOutlining = $false
ShowToolBar
Windows PowerShell ISE 2.0 以降でサポートされています。
WINDOWS PowerShell ISE ウィンドウの上部に ISE ツール バーを表示するかどうかを指定します。 既定値は $true
です。
# Show the toolbar.
$psISE.Options.ShowToolBar = $true
ShowWarningBeforeSavingOnRun
Windows PowerShell ISE 2.0 以降でサポートされています。
スクリプトを実行する前にスクリプトを自動的に保存するときに警告メッセージを表示するかどうかを指定します。
既定値は $true
です。
# Enable the warning message when an attempt
# is made to run a script without saving it first.
$psISE.Options.ShowWarningBeforeSavingOnRun = $true
ShowWarningForDuplicateFiles
Windows PowerShell ISE 2.0 以降でサポートされています。
異なる PowerShell タブで同じファイルを開いたときに警告メッセージを表示するかどうかを指定します。
$true
に設定すると、同じファイルを複数のタブで開くと、次のメッセージが表示されます。"このファイルのコピーは別の Windows PowerShell タブで開いています。このファイルに加えられた変更は、開いているすべてのコピーに影響します。既定値は $true
です。
# Enable the warning message when a file is
# opened in multiple PowerShell tabs.
$psISE.Options.ShowWarningForDuplicateFiles = $true
TokenColors
Windows PowerShell ISE 2.0 以降でサポートされています。
Windows PowerShell ISE スクリプト ウィンドウの IntelliSense トークンの色を指定します。 このプロパティは、スクリプト ウィンドウのトークン型と色の名前と値のペアを含むディクショナリ オブジェクトです。 コンソール ウィンドウで IntelliSense トークンの色を変更するには、「ConsoleTokenColors 」を参照してください。 色を既定値にリセットするには、「RestoreDefaultTokenColors を参照してください。 トークンの色は、属性、Command、CommandArgument、CommandParameter、Comment、GroupEnd、GroupStart、Keyword、LineContinuation、LoopLabel、Member、NewLine、Number、Operator、Position、StatementSeparator、String、Type、Unknown、Variable に設定できます。
# Sets the color of commands to green.
$psISE.Options.TokenColors["Command"] = "green"
# Sets the color of keywords to magenta.
$psISE.Options.TokenColors["Keyword"] = "magenta"
UseEnterToSelectInConsolePaneIntellisense
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
Enter キーを使用して、コンソール ウィンドウで IntelliSense で指定されたオプションを選択できるかどうかを指定します。 既定値は $true
です。
# Turn off using the ENTER key to select an IntelliSense provided option in the Console pane.
$psISE.Options.UseEnterToSelectInConsolePaneIntellisense = $false
UseEnterToSelectInScriptPaneIntellisense
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
Enter キーを使用して、[スクリプト] ウィンドウで IntelliSense で指定されたオプションを選択できるかどうかを指定します。 既定値は $true
です。
# Turn on using the Enter key to select an IntelliSense provided option in the Console pane.
$psISE.Options.UseEnterToSelectInConsolePaneIntellisense = $true
UseLocalHelp
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
カーソルをキーワード内に配置して F1 キーを押したときに、ローカルにインストールされたヘルプまたはオンライン ヘルプを表示するかどうかを指定します。
$true
に設定すると、ローカルにインストールされているヘルプのコンテンツがポップアップ ウィンドウに表示されます。
Update-Help
コマンドを実行して、ヘルプ ファイルをインストールできます。
$false
に設定すると、ブラウザーが開き、Microsoft Learn のページが表示されます。
# Sets the option for the online help to be displayed.
$psISE.Options.UseLocalHelp = $false
# Sets the option for the local Help to be displayed.
$psISE.Options.UseLocalHelp = $true
VerboseBackgroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
コンソール ウィンドウに表示される詳細テキストの背景色を指定します。 System.Windows.Media.Color オブジェクトです。
# Changes the background color for verbose text to blue.
$psISE.Options.VerboseBackgroundColor ='#0000FF'
VerboseForegroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
コンソール ウィンドウに表示される詳細テキストの前景色を指定します。 System.Windows.Media.Color オブジェクトです。
# Changes the foreground color for verbose text to yellow.
$psISE.Options.VerboseForegroundColor = 'yellow'
WarningBackgroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
コンソール ウィンドウに表示される警告テキストの背景色を指定します。 System.Windows.Media.Color オブジェクトです。
# Changes the background color for warning text to blue.
$psISE.Options.WarningBackgroundColor = '#0000FF'
WarningForegroundColor
Windows PowerShell ISE 2.0 以降でサポートされています。
出力ペインに表示される警告テキストの前景色を指定します。 System.Windows.Media.Color オブジェクトです。
# Changes the foreground color for warning text to yellow.
$psISE.Options.WarningForegroundColor = 'yellow'
XmlTokenColors
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
Windows PowerShell ISE に表示される XML コンテンツのトークン型と色の名前と値のペアを含むディクショナリ オブジェクトを指定します。 トークンの色は、属性、Command、CommandArgument、CommandParameter、Comment、GroupEnd、GroupStart、Keyword、LineContinuation、LoopLabel、Member、NewLine、Number、Operator、Position、StatementSeparator、String、Type、Unknown、Variable に設定できます。 RestoreDefaultXmlTokenColors も参照してください。
# Sets the color of XML element names to green.
$psISE.Options.XmlTokenColors["ElementName"] = 'green'
# Sets the color of XML comments to magenta.
$psISE.Options.XmlTokenColors["Comment"] = 'magenta'
ズーム
Windows PowerShell ISE 3.0 以降でサポートされており、以前のバージョンには存在しません。
コンソール ペインとスクリプト ペインの両方のテキストの相対サイズを指定します。 既定値は 100 です。 値が小さいと、Windows PowerShell ISE のテキストが小さく表示され、数値が大きいほどテキストが大きく表示されます。 値は、20 ~ 400 の範囲の整数です。
# Changes the text in the Windows PowerShell ISE to be double its normal size.
$psISE.Options.Zoom = 200
関連項目
PowerShell