Obiekt ISEOptions

Obiekt ISEOptions reprezentuje różne ustawienia środowiska Windows PowerShell ISE. Jest to wystąpienie klasy Microsoft.PowerShell.Host.ISE.ISEOptions .

Obiekt ISEOptions udostępnia następujące metody i właściwości.

Metody

RestoreDefaultConsoleTokenColors()

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Przywraca domyślne wartości kolorów tokenu w okienku Konsola.

# 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()

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Przywraca wartości domyślne wszystkich ustawień opcji w okienku Konsola. Resetuje również zachowanie różnych komunikatów ostrzegawczych, które zapewniają standardowe pole wyboru, aby zapobiec ponownemu wyświetlaniu komunikatu.

# Changes the background color in the Console pane and then restores it to its default value.
$psISE.Options.ConsolePaneBackgroundColor = 'orange'
$psISE.Options.RestoreDefaults()

RestoreDefaultTokenColors()

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Przywraca domyślne wartości kolorów tokenu w okienku Skrypt.

# 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()

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Przywraca domyślne wartości kolorów tokenu dla elementów XML wyświetlanych w środowisku Windows PowerShell ISE. Zobacz też 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()

Właściwości

AutoSaveMinuteInterval

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa liczbę minut między automatycznymi operacjami zapisywania plików przez program Windows PowerShell ISE. Wartość domyślna to 2 minuty. Wartość jest liczbą całkowitą.

# Changes the number of minutes between automatic save operations to every 3 minutes.
$psISE.Options.AutoSaveMinuteInterval = 3

CommandPaneBackgroundColor

Ta funkcja jest obecna w programie Windows PowerShell ISE 2.0, ale została usunięta lub zmieniona w nowszych wersjach środowiska ISE. W przypadku nowszych wersji zobacz ConsolePaneBackgroundColor.

Określa kolor tła okienka Polecenia. Jest to wystąpienie klasy System.Windows.Media.Color .

# Changes the background color of the Command pane to orange.
$psISE.Options.CommandPaneBackgroundColor = 'orange'

CommandPaneUp

Ta funkcja jest obecna w programie Windows PowerShell ISE 2.0, ale została usunięta lub zmieniona w nowszych wersjach środowiska ISE.

Określa, czy okienko Polecenia znajduje się powyżej okienka Dane wyjściowe.

# Moves the Command pane to the top of the screen.
$psISE.Options.CommandPaneUp  = $true

ConsolePaneBackgroundColor

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa kolor tła okienka Konsola. Jest to wystąpienie klasy System.Windows.Media.Color .

# Changes the background color of the Console pane to red.
$psISE.Options.ConsolePaneBackgroundColor = 'red'

ConsolePaneForeGroundColor

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa kolor pierwszego planu tekstu w okienku Konsola.

# Changes the foreground color of the text in the Console pane to yellow.
$psISE.Options.ConsolePaneForegroundColor  = 'yellow'

ConsolePaneTextBackgroundColor

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa kolor tła tekstu w okienku Konsola.

# Changes the background color of the Console pane text to pink.
$psISE.Options.ConsolePaneTextBackgroundColor = 'pink'

ConsoleTokenColors

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa kolory tokenów IntelliSense w okienku Konsola środowiska Windows PowerShell ISE. Ta właściwość jest obiektem słownika, który zawiera pary nazw/wartości typów tokenów i kolorów dla okienka Konsola. Aby zmienić kolory tokenów funkcji IntelliSense w okienku Skrypt, zobacz TokenColors. Aby zresetować kolory do wartości domyślnych, zobacz RestoreDefaultConsoleTokenColors. Kolory tokenu można ustawić dla następujących elementów: Attribute, 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

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolor tła dla tekstu debugowania wyświetlanego w okienku Konsola. Jest to wystąpienie klasy 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

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolor pierwszego planu dla tekstu debugowania wyświetlanego w okienku Konsola. Jest to wystąpienie klasy 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

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Kolekcja właściwości określających wartości domyślne, które mają być używane podczas użycia metod Resetowanie.

# 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

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolor tła tekstu błędu wyświetlanego w okienku Konsola. Jest to wystąpienie klasy 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

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolor pierwszego planu dla tekstu błędu wyświetlanego w okienku Konsola. Jest to wystąpienie klasy 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

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa nazwę czcionki, która jest obecnie używana zarówno w okienku Skrypt, jak i w okienku Konsola.

# Changes the font used in both panes.
$psISE.Options.FontName = 'Courier New'

FontSize

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa rozmiar czcionki jako liczbę całkowitą. Jest on używany w okienku Skrypt, okienku Polecenia i okienku Dane wyjściowe. Prawidłowy zakres wartości to od 8 do 32.

# Changes the font size in all panes.
$psISE.Options.FontSize = 20

IntellisenseTimeoutInSeconds

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa liczbę sekund używanych przez funkcję IntelliSense do rozpoznania aktualnie wpisanego tekstu. Po upływie tej liczby sekund limit czasu funkcji IntelliSense i umożliwia kontynuowanie wpisywania. Wartość domyślna to 3 sekundy. Wartość jest liczbą całkowitą.

# Changes the number of seconds for IntelliSense syntax recognition to 5.
$psISE.Options.IntellisenseTimeoutInSeconds = 5

MruCount

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa liczbę ostatnio otwartych plików, które program Windows PowerShell ISE śledzi i wyświetla w dolnej części menu Otwieranie pliku. Wartość domyślna to 10. Wartość jest liczbą całkowitą.

# Changes the number of recently used files that appear at the bottom of the File Open menu to 5.
$psISE.Options.MruCount = 5

OutputPaneBackgroundColor

Ta funkcja jest obecna w programie Windows PowerShell ISE 2.0, ale została usunięta lub zmieniona w nowszych wersjach środowiska ISE. W przypadku nowszych wersji zobacz ConsolePaneBackgroundColor.

Właściwość odczytu/zapisu, która pobiera lub ustawia kolor tła dla samego okienka Dane wyjściowe. Jest to wystąpienie klasy System.Windows.Media.Color .

# Changes the background color of the Output pane to gold.
$psISE.Options.OutputPaneForegroundColor = 'gold'

OutputPaneTextForegroundColor

Ta funkcja jest obecna w programie Windows PowerShell ISE 2.0, ale została usunięta lub zmieniona w nowszych wersjach środowiska ISE. Aby zapoznać się z nowszymi wersjami, zobacz ConsolePaneForegroundColor.

Właściwość odczytu/zapisu, która zmienia kolor pierwszego planu tekstu w okienku Dane wyjściowe w programie Windows PowerShell ISE 2.0.

# Changes the foreground color of the text in the Output Pane to blue.
$psISE.Options.OutputPaneTextForegroundColor  = 'blue'

OutputPaneTextBackgroundColor

Ta funkcja jest obecna w programie Windows PowerShell ISE 2.0, ale została usunięta lub zmieniona w nowszych wersjach środowiska ISE. W przypadku nowszych wersji zobacz ConsolePaneTextBackgroundColor.

Właściwość odczytu/zapisu, która zmienia kolor tła tekstu w okienku Dane wyjściowe.

# Changes the background color of the Output pane text to pink.
$psISE.Options.OutputPaneTextBackgroundColor = 'pink'

ScriptPaneBackgroundColor

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Właściwość odczytu/zapisu, która pobiera lub ustawia kolor tła dla plików. Jest to wystąpienie klasy System.Windows.Media.Color .

# Sets the color of the script pane background to yellow.
$psISE.Options.ScriptPaneBackgroundColor = 'yellow'

ScriptPaneForeGroundColor

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Właściwość odczytu/zapisu, która pobiera lub ustawia kolor pierwszego planu dla plików innych niż skrypt w okienku Skrypt. Aby ustawić kolor pierwszego planu dla plików skryptów, użyj tokenu TokenColors.

# Sets the foreground to color of non-script files in the script pane to green.
$psISE.Options.ScriptPaneBackgroundColor = 'green'

SelectedScriptPaneState

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Właściwość odczytu/zapisu, która pobiera lub ustawia położenie okienka Skrypt na ekranie. Ciąg może być "Zmaksymalizowany", "Top" lub "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

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa, czy lista fragmentów kodu CTRL+ zawiera zestaw startowy uwzględniony w programie Windows PowerShell. Po ustawieniu wartości $falsena , na liście CTRL+J są wyświetlane tylko fragmenty kodu zdefiniowane przez użytkownika. Domyślna wartość to $true.

# Hide the default snippets from the CTRL+J list.
$psISE.Options.ShowDefaultSnippets = $false

ShowIntellisenseInConsolePane

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa, czy funkcja IntelliSense oferuje sugestie dotyczące składni, parametrów i wartości w okienku Konsola. Domyślna wartość to $true.

# Turn off IntelliSense in the console pane.
$psISE.Options.ShowIntellisenseInConsolePane = $false

ShowIntellisenseInScriptPane

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa, czy funkcja IntelliSense oferuje sugestie dotyczące składni, parametrów i wartości w okienku Skrypt. Domyślna wartość to $true.

# Turn off IntelliSense in the Script pane.
$psISE.Options.ShowIntellisenseInScriptPane = $false

ShowLineNumbers

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa, czy w okienku Skrypt są wyświetlane numery wierszy na lewym marginesie. Domyślna wartość to $true.

# Turn off line numbers in the Script pane.
$psISE.Options.ShowLineNumbers = $false

ShowOutlining

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa, czy w okienku Skrypt są wyświetlane nawiasy rozwijane i zwijane obok sekcji kodu na lewym marginesie. Po ich wyświetleniu można kliknąć ikony minus - obok bloku tekstu, aby go zwinąć lub kliknąć ikonę znaku plus + , aby rozwinąć blok tekstu. Domyślna wartość to $true.

# Turn off outlining in the Script pane.
$psISE.Options.ShowOutlining = $false

ShowToolBar

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa, czy pasek narzędzi ISE jest wyświetlany w górnej części okna środowiska Windows PowerShell ISE. Domyślna wartość to $true.

# Show the toolbar.
$psISE.Options.ShowToolBar = $true

ShowWarningBeforeSavingOnRun

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa, czy podczas automatycznego zapisywania skryptu jest wyświetlany komunikat ostrzegawczy przed jego uruchomieniem. Domyślna wartość to $true.

# Enable the warning message when an attempt
# is made to run a script without saving it first.
$psISE.Options.ShowWarningBeforeSavingOnRun = $true

ShowWarningForDuplicateFiles

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa, czy podczas otwierania tego samego pliku na różnych kartach programu PowerShell jest wyświetlany komunikat ostrzegawczy. Jeśli ustawiono $truewartość , aby otworzyć ten sam plik na wielu kartach, zostanie wyświetlony następujący komunikat: "Kopia tego pliku jest otwarta na innej karcie programu Windows PowerShell. Zmiany wprowadzone w tym pliku będą mieć wpływ na wszystkie otwarte kopie". Wartość domyślna to $true.

# Enable the warning message when a file is
# opened in multiple PowerShell tabs.
$psISE.Options.ShowWarningForDuplicateFiles = $true

TokenColors

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolory tokenów IntelliSense w okienku Skrypt środowiska Windows PowerShell ISE. Ta właściwość jest obiektem słownika, który zawiera pary nazw/wartości typów tokenów i kolorów dla okienka Skrypt. Aby zmienić kolory tokenów funkcji IntelliSense w okienku Konsola, zobacz ConsoleTokenColors. Aby zresetować kolory do wartości domyślnych, zobacz RestoreDefaultTokenColors. Kolory tokenu można ustawić dla następujących elementów: Attribute, 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

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa, czy możesz użyć klawisza Enter, aby wybrać opcję funkcji IntelliSense podaną w okienku Konsola. Domyślna wartość to $true.

# Turn off using the ENTER key to select an IntelliSense provided option in the Console pane.
$psISE.Options.UseEnterToSelectInConsolePaneIntellisense = $false

UseEnterToSelectInScriptPaneIntellisense

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa, czy możesz użyć klawisza Enter, aby wybrać opcję udostępnianą przez funkcję IntelliSense w okienku Skrypt. Domyślna wartość to $true.

# Turn on using the Enter key to select an IntelliSense provided option in the Console pane.
$psISE.Options.UseEnterToSelectInConsolePaneIntellisense = $true

UseLocalHelp

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa, czy lokalnie zainstalowana Pomoc, czy Pomoc online jest wyświetlana po naciśnięciu klawisza F1 z kursorem umieszczonym w słowie kluczowym. Jeśli ustawiono wartość $true, w oknie podręcznym zostanie wyświetlona zawartość z lokalnie zainstalowanej Pomocy. Pliki Pomocy można zainstalować, uruchamiając Update-Help polecenie . Jeśli ustawiono $falsewartość , przeglądarka otworzy stronę w witrynie 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

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolor tła pełnego tekstu wyświetlanego w okienku Konsola. Jest to obiekt System.Windows.Media.Color .

# Changes the background color for verbose text to blue.
$psISE.Options.VerboseBackgroundColor ='#0000FF'

VerboseForegroundColor

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolor pierwszego planu dla pełnego tekstu wyświetlanego w okienku Konsola. Jest to obiekt System.Windows.Media.Color .

# Changes the foreground color for verbose text to yellow.
$psISE.Options.VerboseForegroundColor = 'yellow'

WarningBackgroundColor

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolor tła tekstu ostrzegawczego wyświetlanego w okienku Konsola. Jest to obiekt System.Windows.Media.Color .

# Changes the background color for warning text to blue.
$psISE.Options.WarningBackgroundColor = '#0000FF'

OstrzeżenieForegroundColor

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Określa kolor pierwszego planu dla tekstu ostrzegawczego wyświetlanego w okienku Dane wyjściowe. Jest to obiekt System.Windows.Media.Color .

# Changes the foreground color for warning text to yellow.
$psISE.Options.WarningForegroundColor = 'yellow'

XmlTokenColors

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa obiekt słownika zawierający pary nazw/wartości typów tokenów i kolorów zawartości XML wyświetlanej w środowisku Windows PowerShell ISE. Kolory tokenu można ustawić dla następujących elementów: Attribute, CommandArgument, CommandParameter, Comment, GroupEnd, GroupStart, Keyword, LineContinuation, LoopLabel, Member, NewLine, Number, Operator, Position, StatementSeparator, String, Type, Unknown, Variable. Zobacz również Temat 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'

Powiększ

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Określa względny rozmiar tekstu w okienkach Konsola i Skrypt. Wartość domyślna to 100. Mniejsze wartości powodują, że tekst w środowisku Windows PowerShell ISE jest wyświetlany mniejszy, podczas gdy większe liczby powodują, że tekst będzie większy. Wartość jest liczbą całkowitą, która waha się od 20 do 400.

# Changes the text in the Windows PowerShell ISE to be double its normal size.
$psISE.Options.Zoom = 200

Zobacz też