L'oggetto Options rappresenta varie impostazioni di Windows PowerShell ISE. Si tratta di un'istanza della classe Microsoft.PowerShell.Host.ISE.ISEOptions.
Metodi
RestoreDefaultTokenColors()
Ripristina i valori predefiniti dei colori dei token.
# Changes the color of the comments in the script to red and then restores it to its default value. $psISE.Options.TokenColors["Comment"]="red" $psISE.Options.RestoreDefaultTokenColors()
RestoreDefaults()
Ripristina i valori predefiniti di tutte le impostazioni delle opzioni. Reimposta inoltre il comportamento dei vari messaggi di avviso che forniscono la casella di controllo standard "Non visualizzare più questo messaggio".
# Changes the background color in the Command Pane and then restores it to its default value. $psISE.Options.CommandPaneBackground = "orange" $psISE.Options.RestoreDefaults()
Proprietà
CommandPaneBackgroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per l'editor del riquadro comandi. Si tratta di un'istanza della classe System.Windows.Media.Color.
# Changes the background color of the Command Pane to orange. $psISE.Options.CommandPaneBackground = "orange"
CommandPaneUp
Proprietà di lettura/scrittura che ottiene o imposta un valore booleano che indica se il riquadro comandi si trova sopra il riquadro di output.
# Moves the Command Pane to the top of the screen. $psISE.Options.CommandPaneUp = $true
DebugBackgroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per il testo di debug che viene visualizzato nel riquadro di output. Si tratta di un'istanza della classe System.Windows.Media.Color.
# Changes the background color for the debug text that appears in the Output Pane to blue. $psISE.Options.DebugBackgroundColor ='#0000FF'
DebugForegroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di primo piano per il testo di debug che viene visualizzato nel riquadro di output. Si tratta di un'istanza della classe System.Windows.Media.Color.
# Changes the foreground color for the debug text that appears in the Output Pane to yellow. $psISE.Options.DebugForegroundColor =”yellow”
DefaultOptions
Proprietà di sola lettura che ottiene i valori predefiniti delle impostazioni delle opzioni.
# Displays the name of the default options. $psISE.Options.DefaultOptions
# Here is a typical listing of the default options: SelectedScriptPaneState : Right ShowToolBar : True TokenColors : {[Attribute, #FFADD8E6], [Command, #FF0000FF], [Com mandArgument, #FF8A2BE2], [CommandParameter, #FF000 080]...} DefaultOptions : Microsoft.PowerShell.Host.ISE.ISEOptions FontSize : 12 FontName : Lucida Console ErrorForegroundColor : #FF0000FF ErrorBackgroundColor : #00FFFFFF WarningForegroundColor : #FFFF8C00 WarningBackgroundColor : #00FFFFFF VerboseForegroundColor : #FF0000FF VerboseBackgroundColor : #00FFFFFF DebugForegroundColor : #FF0000FF DebugBackgroundColor : #00FFFFFF OutputPaneBackgroundColor : #FFF0F8FF OutputPaneTextBackgroundColor : #FFF0F8FF OutputPaneForegroundColor : #FF000000 CommandPaneBackgroundColor : #FFFFFFFF ScriptPaneBackgroundColor : #FFFFFFFF ShowWarningForDuplicateFiles : True ShowWarningBeforeSavingOnRun : True UseLocalHelp : True CommandPaneUp : False
ErrorBackgroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per il testo di errore che viene visualizzato nel riquadro di output. Si tratta di un'istanza della classe System.Windows.Media.Color.
# Changes the background color for the error text that appears in the Output Pane to black. $psISE.Options.ErrorBackgroundColor="black"
ErrorForegroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di primo piano per il testo di errore che viene visualizzato nel riquadro di output. Si tratta di un'istanza della classe System.Windows.Media.Color.
# Changes the foreground color for the error text that appears in the Output Pane to green. $psISE.Options.ErrorForegroundColor =”green”
FontName
Proprietà di lettura/scrittura che ottiene o imposta il nome del tipo di carattere utilizzato nel riquadro di script, nel riquadro comandi e nel riquadro di ouput.
# Changes the font used in all the panes. $psISE.Options.FontName = "courier new"
FontSize
Proprietà di lettura/scrittura che ottiene o imposta le dimensioni del tipo di carattere (valore intero) utilizzato nel riquadro di script, nel riquadro comandi e nel riquadro di ouput. L'intervallo valido di valori è compreso tra 8 e 32.
# Changes the font size in all the panes. $psISE.Options.FontSize = 20
OutputPaneBackgroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per il riquadro di output. Si tratta di un'istanza della classe System.Windows.Media.Color.
# Changes the background color of the Output Pane to gold. $psISE.Options.OutputPaneForegroundColor = "gold"
OutputPaneTextForegroundColor
Proprietà di lettura/scrittura che modifica il colore di primo piano del testo nel riquadro di output.
# Changes the foreground color of the text in the Output Pane to blue. $psISE.Options.OutputPaneTextForegroundColor = "blue"
OutputPaneTextBackgroundColor
Proprietà di lettura/scrittura che modifica il colore di sfondo del testo nel riquadro di output.
# Changes the background color of the Output Pane text to pink. $psISE.Options.OutputPaneTextBackgroundColor = "pink"
ScriptPaneBackgroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per i file. Si tratta di un'istanza della classe System.Windows.Media.Color.
# Sets the color of the script pane background to yellow. $psISE.Options.ScriptPaneBackgroundColor = ”yellow”
ScriptPaneForegroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di primo piano per file non di script nel riquadro di script. Per impostare il colore di primo piano per i file di script, utilizzare la proprietà TokenColors.
# Sets the foreground to color of non-script files in the script pane to green. $psISE.Options.ScriptPaneBackgroundColor = ”green”
SelectedScriptPaneState
Proprietà di lettura/scrittura che ottiene o imposta la posizione del riquadro di script sullo schermo. I valori possibili sono "top", "right" e "Maximized".
# 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"
ShowToolBar
Proprietà booleana di lettura/scrittura che determina se la barra degli strumenti è visibile o meno.
# Show the tool bar. $psISe.Options.ShowToolBar = $true
ShowWarningBeforeSavingOnRun
Proprietà di lettura/scrittura che ottiene o imposta un valore booleano che determina se un messaggio di avviso viene visualizzato quando uno script viene salvato automaticamente prima che venga eseguito.
# Sets the option to display a warning message # when an attempt is made to save a script before running it. $psISE.Options.ShowWarningBeforeSavingOnRun=$true
ShowWarningForDuplicateFiles
Proprietà di lettura/scrittura che ottiene o imposta un valore booleano che comporta la visualizzazione di un messaggio di avviso quando lo stesso file viene aperto in più schede di PowerShell.
# Set the ShowWarningForDuplicateFiles property to true. $psISE.Options.ShowWarningForDuplicateFiles = $true # The following message is displayed: “A copy of this file # is open in another PowerShell Tab. Changes made to this # file will affect all open copies.”
TokenColors
Proprietà che ottiene un oggetto dizionario contenente coppie nome/valore di tipi di token e colori per il riquadro comandi e il riquadro di script.
# Sets the color of commands to green. $psISE.Options.TokenColors["Command"] = "green" # Sets the color of keywords to magenta. $psISE.Options.TokenColors["Keyword"] = "magenta"
UseLocalHelp
Proprietà di lettura/scrittura che ottiene o imposta un valore booleano che indica se viene visualizzata la Guida locale o la Guida online.
# Sets the option for the online help to be displayed. $psISE.Options.LocalHelp=$false
VerboseBackgroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per il testo dettagliato che viene visualizzato nel riquadro di output. Si tratta di un oggetto System.Windows.Media.Color.
# Changes the background color for the verbose text that appears in the Output Pane to blue. $psISE.Options.VerboseBackgroundColor ='#0000FF'
VerboseForegroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di primo piano per il testo dettagliato che viene visualizzato nel riquadro di output. Si tratta di un oggetto System.Windows.Media.Color.
# Changes the foreground color for the verbose text that appears in the Output Pane to yellow. $psISE.Options.VerboseForegroundColor =”yellow”
WarningBackgroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di sfondo per il testo di avviso che viene visualizzato nel riquadro di output. Si tratta di un oggetto System.Windows.Media.Color.
# Changes the background color for the warning text that appears in the Output Pane to blue. $psISE.Options.WarningBackgroundColor ='#0000FF'
WarningForegroundColor
Proprietà di lettura/scrittura che ottiene o imposta il colore di primo piano per il testo dell'avviso che viene visualizzato nel riquadro di output. Si tratta di un oggetto System.Windows.Media.Color.
# Changes the foreground color for the warning text that appears in the Output Pane to yellow. $psISE.Options.WarningForegroundColor =”yellow”
Vedere anche