ISEOptionsオブジェクトはWindows PowerShell ISEのさまざまな設定を表しています。 これは Microsoft.PowerShell.Host.ISE.ISEOptions クラスのインスタンスです。
ISEOptionsオブジェクトは以下のメソッドとプロパティを提供します。
Methods
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
CommandPane背景色
この機能はWindows PowerShell ISE 2.0に搭載されていますが、後のバージョンで削除または名前変更されました。 後のバージョンについては 、ConsolePaneBackgroundColorをご覧ください。
コマンドペインの背景色を指定します。 これは System.Windows.Media.Color クラスのインスタンスです。
# Changes the background color of the Command pane to orange.
$psISE.Options.CommandPaneBackgroundColor = 'orange'
コマンドPaneUp
この機能はWindows PowerShell ISE 2.0に搭載されていますが、後のバージョンで削除または名前変更されました。
コマンドペインが出力ペインの上にあるかどうかを指定します。
# Moves the Command pane to the top of the screen.
$psISE.Options.CommandPaneUp = $true
コンソールパネル背景色
Windows PowerShell ISE 3.0以降でサポートされており、以前のバージョンには含まれていません。
コンソールパネルの背景色を指定します。 これは System.Windows.Media.Color クラスのインスタンスです。
# Changes the background color of the Console pane to red.
$psISE.Options.ConsolePaneBackgroundColor = 'red'
コンソールパネル前景色
Windows PowerShell ISE 3.0以降でサポートされており、以前のバージョンには含まれていません。
コンソールペインのテキストの前景色を指定します。
# Changes the foreground color of the text in the Console pane to yellow.
$psISE.Options.ConsolePaneForegroundColor = 'yellow'
コンソールパネルテキスト背景色
Windows PowerShell ISE 3.0以降でサポートされており、以前のバージョンには含まれていません。
コンソールペイン内のテキストの背景色を指定します。
# Changes the background color of the Console pane text to pink.
$psISE.Options.ConsolePaneTextBackgroundColor = 'pink'
コンソールトークンカラーズ
Windows PowerShell ISE 3.0以降でサポートされており、以前のバージョンには含まれていません。
Windows PowerShell ISE コンソールのパネル内のIntelliSenseトークンの色を指定します。 このプロパティは、コンソールのペイン用にトークンの種類と色の名前/値ペアを含む辞書オブジェクトです。 スクリプトパネル内のIntelliSenseトークンの色を変更するには、 TokenColorsをご覧ください。 色をデフォルト値にリセットするには、 RestoreDefaultConsoleTokenColorsをご覧ください。 トークンの色は以下の通りに設定できます: Attribute、 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'
デフォルトオプション
Windows PowerShell ISE 2.0以降でサポートされています。
リセットメソッドを使用する際に使用するデフォルト値を指定するプロパティの集合です。
# 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 : #FFFF9494
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
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'
フォントサイズ
Windows PowerShell ISE 2.0以降でサポートされています。
フォントサイズを整数で指定します。 スクリプトペイン、コマンドペイン、出力ペインで使われます。 有効範囲は8から32です。
# Changes the font size in all panes.
$psISE.Options.FontSize = 20
インテリセンスタイムアウトイン秒
Windows PowerShell ISE 3.0以降でサポートされており、以前のバージョンには含まれていません。
IntelliSenseが現在入力中のテキストを解析しようとするのに使う秒数を指定します。 この数秒が過ぎるとIntelliSenseはタイムアウトし、タイピングを再開できるようになります。 デフォルト値は3秒です。 値は整数です。
# Changes the number of seconds for IntelliSense syntax recognition to 5.
$psISE.Options.IntellisenseTimeoutInSeconds = 5
ムルカウント
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に搭載されていますが、後のバージョンで削除または名前変更されました。 後のバージョンについては 、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に搭載されていますが、後のバージョンで削除または名前変更されました。 後のバージョンについては、 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に搭載されていますが、後のバージョンで削除または名前変更されました。 後のバージョンについては 、ConsolePaneTextBackgroundColorをご覧ください。
Outputペインのテキストの背景色を変更する読み書きプロパティです。
# Changes the background color of the Output pane text to pink.
$psISE.Options.OutputPaneTextBackgroundColor = 'pink'
スクリプトパン背景色
Windows PowerShell ISE 2.0以降でサポートされています。
ファイルの背景色を取得する、または設定する読み書きプロパティです。 これは System.Windows.Media.Color クラスのインスタンスです。
# Sets the color of the script pane background to yellow.
$psISE.Options.ScriptPaneBackgroundColor = 'yellow'
スクリプトパン前景色
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以降でサポートされています。
Script Panの表示表示の位置を取得または設定する読み書きプロパティです。 文字列は「最大化済み」、「トップ」、「右」のいずれかに設定できます。
# 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以降でサポートされており、以前のバージョンには含まれていません。
コンソールペインで構文、パラメータ、値の提案があるかどうかを指定します。
既定値は $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
ショーラインナンバーズ
Windows PowerShell ISE 3.0以降でサポートされており、以前のバージョンには含まれていません。
スクリプトパネルの左余白に行番号を表示するかどうかを指定します。 既定値は $true です。
# Turn off line numbers in the Script pane.
$psISE.Options.ShowLineNumbers = $false
ショーアウトライン作成
Windows PowerShell ISE 3.0以降でサポートされており、以前のバージョンには含まれていません。
スクリプトのペインが左余白のコードセクションの横に展開可能または折りたたみ可能な括弧を表示するかどうかを指定します。 表示されたら、テキストブロックの横にあるマイナス - アイコンをクリックしてフォルダを閉じたり、プラス + アイコンをクリックしてテキストブロックを展開したりできます。 既定値は $true です。
# Turn off outlining in the Script pane.
$psISE.Options.ShowOutlining = $false
ショーツールバー
Windows PowerShell ISE 2.0以降でサポートされています。
ISEツールバーがWindows PowerShell ISEウィンドウの上部に表示されるかどうかを指定します。 既定値は $true です。
# Show the toolbar.
$psISE.Options.ShowToolBar = $true
ShowWarningSavingOnRun 前に
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
重複ファイルの警告表示
Windows PowerShell ISE 2.0以降でサポートされています。
同じファイルを異なるPowerShellタブで開いたときに警告メッセージが表示されるかどうかを指定します。
$trueに設定した場合、同じファイルを複数のタブで開くと次のメッセージが表示されます:「このファイルのコピーが別のWindowsPowerShellタブで開かれています。このファイルに加えられた変更は、すべての開いているコピーに影響を与えます。」デフォルト値は$trueです。
# Enable the warning message when a file is
# opened in multiple PowerShell tabs.
$psISE.Options.ShowWarningForDuplicateFiles = $true
トークンカラーズ
Windows PowerShell ISE 2.0以降でサポートされています。
Windows PowerShell ISE スクリプトのパネル内のIntelliSenseトークンの色を指定します。 このプロパティは、スクリプトパネルのトークンタイプと色の名前/値ペアを含む辞書オブジェクトです。 コンソールペイン内のIntelliSenseトークンの色を変更するには、 ConsoleTokenColorsをご覧ください。 色をデフォルト値にリセットするには、 RestoreDefaultTokenColorsを参照してください。 トークンの色は以下のものに設定できます:Attribute、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
冗長背景色
Windows PowerShell ISE 2.0以降でサポートされています。
コンソール画面に表示される冗長なテキストの背景色を指定します。 System.Windows.Media.Colorオブジェクトです。
# Changes the background color for verbose text to blue.
$psISE.Options.VerboseBackgroundColor ='#0000FF'
冗長前景色
Windows PowerShell ISE 2.0以降でサポートされています。
コンソールのペインに表示される冗長なテキストの前景色を指定します。 System.Windows.Media.Colorオブジェクトです。
# Changes the foreground color for verbose text to yellow.
$psISE.Options.VerboseForegroundColor = 'yellow'
警告背景色
Windows PowerShell ISE 2.0以降でサポートされています。
コンソールペインに表示される警告テキストの背景色を指定します。 System.Windows.Media.Colorオブジェクトです。
# Changes the background color for warning text to blue.
$psISE.Options.WarningBackgroundColor = '#0000FF'
警告 前景色
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コンテンツのトークンタイプと色の名前/値ペアを含む辞書オブジェクトを指定します。 トークンの色は以下のものに設定できます:Attribute、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