Condividi tramite


L'Oggetto ISEOptions

L'oggetto ISEOptions rappresenta varie impostazioni per Windows PowerShell ISE. È un'istanza della classe Microsoft.PowerShell.Host.ISE.ISEOptions .

L'oggetto ISEOptions fornisce i seguenti metodi e proprietà.

Methods

RestoreDefaultConsoleTokenColors()

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Ripristina i valori predefiniti dei colori dei token nel pannello Console.

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

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Ripristina i valori predefiniti di tutte le impostazioni di opzione nel pannello Console. Azzera inoltre il comportamento di vari messaggi di avviso che forniscono la casella di spunta standard per impedire che il messaggio venga mostrato di nuovo.

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

RestoreDefaultTokenColors()

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Ripristina i valori predefiniti dei colori dei token nel pannello Script.

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

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Ripristina i valori predefiniti dei colori dei token per gli elementi XML visualizzati in Windows PowerShell ISE. Vedi anche 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()

Proprietà

AutoSaveMinuteInterval

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica il numero di minuti tra le operazioni di salvataggio automatico dei tuoi file tramite Windows PowerShell ISE. Il valore predefinito è 2 minuti. Il valore è un intero.

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

CommandPaneBackgroundColor

Questa funzione è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE. Per le versioni successive, vedi ConsolePaneBackgroundColor.

Specifica il colore di sfondo per il pannello Comando. È un'istanza della classe System.Windows.Media.Color .

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

CommandPaneUp

Questa funzione è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE.

Specifica se il pannello Comando si trova sopra il pannello di Output.

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

ConsolePaneBackgroundColor

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica il colore di sfondo per il pannello Console. È un'istanza della classe System.Windows.Media.Color .

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

ConsolePaneForegroundColor

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica il colore in primo piano del testo nel pannello Console.

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

ConsolePaneTestoSfondoColore

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica il colore di sfondo del testo nel pannello Console.

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

ConsoleTokenColors

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica i colori dei token IntelliSense nel pannello della console ISE di Windows PowerShell. Questa proprietà è un oggetto dizionario che contiene coppie nome/valore di tipi di token e colori per il pannello Console. Per cambiare i colori dei token IntelliSense nel pannello Script, vedi TokenColors. Per reimpostare i colori ai valori predefiniti, vedi RestoreDefaultConsoleTokenColors. I colori dei gettoni possono essere impostati per i seguenti modi: Attribute, Command, CommandArgumentCommandParameter, CommentGroupEnd, , GroupStart, Keyword, LineContinuationLoopLabelMemberNewLineNumberOperatorPositionStatementSeparatorStringTypeUnknownVariable.

# 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

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il colore di sfondo per il testo di debug che appare nel pannello Console. È un'istanza della classe 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

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il colore in primo piano per il testo di debug che appare nel pannello Console. È un'istanza della classe 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

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Una raccolta di proprietà che specificano i valori predefiniti da utilizzare quando vengono utilizzati i metodi 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                      : #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

ErroreColoreSfondoColore

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il colore di sfondo per il testo di errore che appare nel pannello Console. È un'istanza della classe 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

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il colore in primo piano per il testo di errore che appare nel pannello Console. È un'istanza della classe 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

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il nome del font attualmente in uso sia nel pannello Script che nel pannello Console.

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

Dimensione del carattere

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica la dimensione del font come intero. Viene usato nel pannello Script, nel pannello Comando e nel pannello Output. L'intervallo valido di valori è da 8 a 32.

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

IntellisenseTimeoutInSeconds

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica il numero di secondi che IntelliSense utilizza per cercare di risolvere il testo attualmente digitato. Dopo questo numero di secondi, IntelliSense spegne il tempo e ti permette di continuare a digitare. Il valore predefinito è 3 secondi. Il valore è un intero.

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

MruCount

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica il numero di file aperti di recente che Windows PowerShell ISE traccia e visualizza in basso nel menu Aperti file . Il valore predefinito è 10. Il valore è un intero.

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

OutputPaneBackgroundColor

Questa funzione è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE. Per le versioni successive, vedi ConsolePaneBackgroundColor.

La proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per il pannello di uscita stesso. È un'istanza della classe System.Windows.Media.Color .

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

OutputPaneTextForegroundColor

Questa funzione è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE. Per le versioni successive, vedi ConsolePaneForegroundColor.

La proprietà di lettura/scrittura che cambia il colore in primo piano del testo nel pannello di uscita in Windows PowerShell ISE 2.0.

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

OutputPaneTestoBackgroundColor

Questa funzione è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE. Per le versioni successive, vedi ConsolePaneTextBackgroundColor.

La proprietà di lettura/scrittura che cambia il colore di sfondo del testo nel pannello di Output.

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

ScriptPaneColoreBackground

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

La proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per i file. È un'istanza della classe System.Windows.Media.Color .

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

ScriptPaneForegroundColor

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

La proprietà di lettura/scrittura che ottiene o imposta il colore in primo piano per i file non script nel pannello Script. Per impostare il colore in primo piano per i file di script, usa i TokenColors.

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

SelezionatoScriptPaneState

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

La proprietà di lettura/scrittura che ottiene o imposta la posizione del pannello Script sul display. La stringa può essere 'Massimizzata', 'Superiore' o 'Destra'.

# 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

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica se la lista di snippet Ctrl+J include il set di partenza incluso in Windows PowerShell. Quando impostato su $false, solo frammenti definiti dall'utente appaiono nella lista Ctrl+J . Il valore predefinito è $true.

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

ShowIntellisenseInConsolePane

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica se IntelliSense offre suggerimenti di sintassi, parametri e valori nel pannello Console. Il valore predefinito è $true.

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

ShowIntellisenseInScriptPane

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica se IntelliSense offre suggerimenti di sintassi, parametri e valori nel pannello Script. Il valore predefinito è $true.

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

ShowLineNumbers

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica se il pannello Script mostra i numeri di riga nel margine sinistro. Il valore predefinito è $true.

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

ShowScaling

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica se il pannello Script mostra parentesi espandibili e pieghevoli accanto a sezioni di codice nel margine sinistro. Quando vengono visualizzate, puoi cliccare sulle icone meno - accanto a un blocco di testo per comprimerlo oppure cliccare sull'icona più + per espandere un blocco di testo. Il valore predefinito è $true.

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

ShowToolBar

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica se la barra degli strumenti ISE appare in cima alla finestra ISE di Windows PowerShell. Il valore predefinito è $true.

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

MostraAvvisoPrima di SalvareScappa

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica se appare un messaggio di avviso quando uno script viene salvato automaticamente prima dell'esecuzione. Il valore predefinito è $true.

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

MostraAvvisoProProDuplicateFiles

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica se appare un messaggio di avviso quando lo stesso file viene aperto in diverse schede PowerShell. Se impostato su $true, per aprire lo stesso file in più schede viene visualizzato questo messaggio: "Una copia di questo file è aperta in un'altra scheda PowerShell di Windows. Le modifiche apportate a questo file influenzeranno tutte le copie aperte." Il valore predefinito è $true.

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

TokenColors

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica i colori dei token IntelliSense nel pannello script ISE di Windows PowerShell. Questa proprietà è un oggetto dizionario che contiene coppie nome/valore di tipi di token e colori per il pannello Script. Per cambiare i colori dei token IntelliSense nel pannello Console, vedi ConsoleTokenColors. Per reimpostare i colori ai valori predefiniti, vedi RestoreDefaultTokenColors. I colori dei token possono essere impostati per i seguenti elementi: Attributo, Comando, ArguzioCommand, CommandParameter, Commento, FineGruppo, InizioGruppo, Parola chiave, ContinuazioneLinea, Etichetta Loop, Membro, LineaNuova Linea, Numero, Operatore, Posizione, Separatore dell'Istruzione, Stringa, Tipo, Sconosciuto, Variabile.

# 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

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica se puoi usare il tasto Invio per selezionare un'opzione fornita da IntelliSense nel pannello Console. Il valore predefinito è $true.

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

UseEnterToSelectInScriptPaneIntellisense

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica se puoi usare il tasto Invio per selezionare un'opzione fornita da IntelliSense nel pannello Script. Il valore predefinito è $true.

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

UsaAiutoLocale

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica se l'Aiuto installato localmente o l'Aiuto online appare quando premi F1 con il cursore posizionato in una parola chiave. Se impostato su $true, allora una finestra pop-up mostra contenuti dall'Aiuto installato localmente. Puoi installare i file di Help eseguendo il Update-Help comando. Se impostato su $false, il browser si apre su una pagina su 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

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il colore di sfondo per il testo prolizzio che appare nel pannello Console. È un oggetto System.Windows.Media.Color .

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

VerboseForegroundColor

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il colore in primo piano per il testo verboso che appare nel pannello Console. È un oggetto System.Windows.Media.Color .

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

AvvisoColoreSfondo

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il colore di sfondo per il testo di avvertimento che appare nel pannello Console. È un oggetto System.Windows.Media.Color .

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

AttenzionePrimo Piano Colore

Supportato in Windows PowerShell ISE 2.0 e versioni successive.

Specifica il colore in primo piano per il testo di avvertimento che appare nel pannello di Output. È un oggetto System.Windows.Media.Color .

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

XmlTokenColors

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica un oggetto dizionario che contiene coppie nome/valore di tipi di token e colori per contenuti XML visualizzati in Windows PowerShell ISE. I colori dei token possono essere impostati per i seguenti elementi: Attributo, Comando, ArguzioCommand, CommandParameter, Commento, FineGruppo, InizioGruppo, Parola chiave, ContinuazioneLinea, Etichetta Loop, Membro, LineaNuova Linea, Numero, Operatore, Posizione, Separatore dell'Istruzione, Stringa, Tipo, Sconosciuto, Variabile. Vedi anche 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'

Zoom

Supportato in Windows PowerShell ISE 3.0 e successivi, e non presente nelle versioni precedenti.

Specifica la dimensione relativa del testo sia nel pannello Console che in quello Script. Il valore predefinito è 100. Valori più piccoli fanno apparire il testo in Windows PowerShell ISE mentre numeri maggiori fanno apparire il testo più grande. Il valore è un intero che varia da 20 a 400.

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

Vedere anche