Oggetto ISEOptions
L'oggetto ISEOptions rappresenta varie impostazioni per Windows PowerShell ISE. Si tratta di un'istanza della classe Microsoft.PowerShell.Host.ISE.ISEOptions.
L'oggetto ISEOptions fornisce i metodi e le proprietà seguenti.
Metodi
RestoreDefaultConsoleTokenColors()
Supportato in Windows PowerShell ISE 3.0 e versioni successive e non presente nelle versioni precedenti.
Ripristina i valori predefiniti dei colori del token nel riquadro 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 delle opzioni nel riquadro Console. Reimposta inoltre il comportamento di vari messaggi di avviso che forniscono la casella di controllo standard per impedire che il messaggio venga visualizzato 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 del token nel riquadro 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 versioni successive e non presente nelle versioni precedenti.
Ripristina i valori predefiniti dei colori del token per gli elementi XML visualizzati in Windows PowerShell ISE. Vedere 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 versioni successive e non presente nelle versioni precedenti.
Specifica il numero di minuti tra le operazioni di salvataggio automatico dei file da Windows PowerShell ISE. Il valore predefinito è 2 minuti. Il valore è un numero intero.
# Changes the number of minutes between automatic save operations to every 3 minutes.
$psISE.Options.AutoSaveMinuteInterval = 3
CommandPaneBackgroundColor
Questa funzionalità è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE. Per le versioni successive, vedere ConsolePaneBackgroundColor.
Specifica il colore di sfondo per il riquadro 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 funzionalità è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE.
Specifica se il riquadro Comando si trova sopra il riquadro Output.
# Moves the Command pane to the top of the screen.
$psISE.Options.CommandPaneUp = $true
ConsolePaneBackgroundColor
Supportato in Windows PowerShell ISE 3.0 e versioni successive e non presente nelle versioni precedenti.
Specifica il colore di sfondo per il riquadro 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 versioni successive e non presente nelle versioni precedenti.
Specifica il colore di primo piano del testo nel riquadro Console.
# Changes the foreground color of the text in the Console pane to yellow.
$psISE.Options.ConsolePaneForegroundColor = 'yellow'
ConsolePaneTextBackgroundColor
Supportato in Windows PowerShell ISE 3.0 e versioni successive e non presente nelle versioni precedenti.
Specifica il colore di sfondo del testo nel riquadro 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 versioni successive e non presente nelle versioni precedenti.
Specifica i colori dei token IntelliSense nel riquadro della console di Windows PowerShell ISE. Questa proprietà è un oggetto dizionario che contiene coppie nome/valore di tipi di token e colori per il riquadro console. Per modificare i colori dei token IntelliSense nel riquadro Script, vedere TokenColors. Per reimpostare i colori sui valori predefiniti, vedere RestoreDefaultConsoleTokenColors. I colori dei token possono essere impostati per gli elementi seguenti: 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
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Specifica il colore di sfondo per il testo di debug visualizzato nel riquadro 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 di primo piano per il testo di debug visualizzato nel riquadro 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.
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 : #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
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Specifica il colore di sfondo per il testo di errore visualizzato nel riquadro 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 di primo piano per il testo di errore visualizzato nel riquadro della 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 tipo di carattere attualmente in uso sia nel riquadro Script che nel riquadro Console.
# Changes the font used in both panes.
$psISE.Options.FontName = 'Courier New'
FontSize
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Specifica la dimensione del carattere come numero intero. Viene usato nel riquadro Script, nel riquadro Comando e nel riquadro Output. L'intervallo valido di valori è compreso tra 8 e 32.
# Changes the font size in all panes.
$psISE.Options.FontSize = 20
IntellisenseTimeoutInSeconds
Supportato in Windows PowerShell ISE 3.0 e versioni successive e non presente nelle versioni precedenti.
Specifica il numero di secondi usati da IntelliSense per tentare di risolvere il testo attualmente digitato. Dopo questo numero di secondi, IntelliSense raggiunge il timeout e consente di continuare a digitare. Il valore predefinito è 3 secondi. Il valore è un numero 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 versioni successive e non presente nelle versioni precedenti.
Specifica il numero di file aperti di recente che Windows PowerShell ISE tiene traccia e visualizza nella parte inferiore del menu File Open. Il valore predefinito è 10. Il valore è un numero 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 funzionalità è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE. Per le versioni successive, vedere ConsolePaneBackgroundColor.
Proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per il riquadro Output 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 funzionalità è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE. Per le versioni successive, vedere ConsolePaneForegroundColor.
Proprietà di lettura/scrittura che modifica il colore di primo piano del testo nel riquadro Output in Windows PowerShell ISE 2.0.
# Changes the foreground color of the text in the Output Pane to blue.
$psISE.Options.OutputPaneTextForegroundColor = 'blue'
OutputPaneTextBackgroundColor
Questa funzionalità è presente in Windows PowerShell ISE 2.0, ma è stata rimossa o rinominata nelle versioni successive dell'ISE. Per le versioni successive, vedere ConsolePaneTextBackgroundColor.
Proprietà di lettura/scrittura che modifica il colore di sfondo del testo nel riquadro Output.
# Changes the background color of the Output pane text to pink.
$psISE.Options.OutputPaneTextBackgroundColor = 'pink'
ScriptPaneBackgroundColor
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
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.
Proprietà di lettura/scrittura che ottiene o imposta il colore di primo piano per i file non script nel riquadro Script. Per impostare il colore di primo piano per i file di script, usare il TokenColors.
# Sets the foreground to color of non-script files in the script pane to green.
$psISE.Options.ScriptPaneBackgroundColor = 'green'
SelectedScriptPaneState
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Proprietà di lettura/scrittura che ottiene o imposta la posizione del riquadro Script nella visualizzazione. La stringa può essere 'Ingrandita', 'Top' o '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
Supportato in Windows PowerShell ISE 3.0 e versioni successive e non presente nelle versioni precedenti.
Specifica se il CTRL+J elenco di frammenti di codice include il set di avvio incluso in Windows PowerShell. Se impostato su $false
, vengono visualizzati solo frammenti definiti dall'utente nell'elenco 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 versioni successive e non presente nelle versioni precedenti.
Specifica se IntelliSense offre suggerimenti per sintassi, parametri e valori nel riquadro Della 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 versioni successive e non presente nelle versioni precedenti.
Specifica se IntelliSense offre suggerimenti per sintassi, parametri e valori nel riquadro 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 versioni successive e non presente nelle versioni precedenti.
Specifica se nel riquadro Script vengono visualizzati i numeri di riga nel margine sinistro. Il valore predefinito è $true
.
# Turn off line numbers in the Script pane.
$psISE.Options.ShowLineNumbers = $false
ShowOutlining
Supportato in Windows PowerShell ISE 3.0 e versioni successive e non presente nelle versioni precedenti.
Specifica se il riquadro Script visualizza parentesi espandibili e comprimibili accanto a sezioni di codice nel margine sinistro. Quando vengono visualizzate, è possibile fare clic sull'icona meno -
accanto a un blocco di testo per comprimerla o fare clic sull'icona del segno 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 viene visualizzata nella parte superiore della finestra di Windows PowerShell ISE. Il valore predefinito è $true
.
# Show the toolbar.
$psISE.Options.ShowToolBar = $true
ShowWarningBeforeSavingOnRun
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Specifica se viene visualizzato 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
ShowWarningForDuplicateFiles
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Specifica se viene visualizzato un messaggio di avviso quando lo stesso file viene aperto in schede di PowerShell diverse. 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 di Windows PowerShell. Le modifiche apportate a questo file avranno effetto su 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 riquadro Script di Windows PowerShell ISE. Questa proprietà è un oggetto dizionario che contiene coppie nome/valore di tipi di token e colori per il riquadro Script. Per modificare i colori dei token IntelliSense nel riquadro Console, vedere ConsoleTokenColors. Per reimpostare i colori sui valori predefiniti, vedere RestoreDefaultTokenColors. I colori dei token possono essere impostati per gli elementi seguenti: 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
Supportato in Windows PowerShell ISE 3.0 e versioni successive e non presente nelle versioni precedenti.
Specifica se è possibile usare il tasto INVIO per selezionare un'opzione Fornita da IntelliSense nel riquadro della 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 versioni successive e non presente nelle versioni precedenti.
Specifica se è possibile usare il tasto INVIO per selezionare un'opzione fornita da IntelliSense nel riquadro 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
UseLocalHelp
Supportato in Windows PowerShell ISE 3.0 e versioni successive e non presente nelle versioni precedenti.
Specifica se la Guida installata localmente o la Guida online viene visualizzata quando si preme F1 con il cursore posizionato in una parola chiave. Se impostato su $true
, una finestra popup mostra il contenuto della Guida installata localmente. È possibile installare i file della Guida eseguendo il comando Update-Help
. Se impostato su $false
, il browser si apre su una pagina in 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 dettagliato visualizzato nel riquadro della console. Si tratta di 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 di primo piano per il testo dettagliato visualizzato nel riquadro console. Si tratta di un oggetto system.Windows.Media.Color.
# Changes the foreground color for verbose text to yellow.
$psISE.Options.VerboseForegroundColor = 'yellow'
WarningBackgroundColor
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Specifica il colore di sfondo per il testo di avviso visualizzato nel riquadro console. Si tratta di un oggetto system.Windows.Media.Color.
# Changes the background color for warning text to blue.
$psISE.Options.WarningBackgroundColor = '#0000FF'
WarningForegroundColor
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Specifica il colore di primo piano per il testo di avviso visualizzato nel riquadro Output. Si tratta di 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 versioni successive e non presente nelle versioni precedenti.
Specifica un oggetto dizionario che contiene coppie nome/valore di tipi di token e colori per il contenuto XML visualizzato in Windows PowerShell ISE. I colori dei token possono essere impostati per gli elementi seguenti: Attribute, Command, CommandArgument, CommandParameter, Comment, GroupEnd, GroupStart, Keyword, LineContinuation, LoopLabel, Member, NewLine, Number, Operator, Position, StatementSeparator, String, Type, Unknown, Variable. Vedere 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 versioni successive e non presente nelle versioni precedenti.
Specifica le dimensioni relative del testo nei riquadri Console e Script. Il valore predefinito è 100. I valori più piccoli causano la visualizzazione del testo in Windows PowerShell ISE, mentre i numeri più grandi causano la visualizzazione del testo più grande. Il valore è un numero intero compreso tra 20 e 400.
# Changes the text in the Windows PowerShell ISE to be double its normal size.
$psISE.Options.Zoom = 200