Preference Variables

PowerShell preferences:

    Variable                         Default Value     Options
    --------                         -------------     --------------------------------
    $ConfirmPreference               High              (none | low | medium | high)
    $DebugPreference                 SilentlyContinue  (Write-Debug) (stop | Enquire | continue | SilentlyContinue)
    $ErrorActionPreference           Continue          (Write-Error) (stop | Enquire | continue | SilentlyContinue)
    $ErrorView                       NormalView        (NormalView | CategoryView)
    $FormatEnumerationLimit          4
    $LogCommandHealthEvent           False (not logged)
    $LogCommandLifecycleEvent        False (not logged)
    $LogEngineHealthEvent            True (logged)
    $LogEngineLifecycleEvent         True (logged)
    $LogProviderLifecycleEvent       True (logged)
    $LogProviderHealthEvent          True (logged)
    $MaximumAliasCount               4096     Max no. of aliases available to the session. Valid values: 1024-32768
    $MaximumDriveCount               4096     Max no. of drives available, excluding those provided by the OS.
    $MaximumErrorCount               256      Valid values: 256 - 32768
    $MaximumFunctionCount            4096     Max no. of functions available to the session.
    $MaximumHistoryCount             64       Max no. of entries saved in the command history. Valid values: 1-32768
    $MaximumVariableCount            4096     Max no. of variables available to the session.
    $OFS                             Space " "  Output Field Separator (converting an array to string.)
    $OutputEncoding                  ASCIIEncoding object
                                     Valid values: Objects derived from an Encoding class, such as:
                                         ASCIIEncoding, SBCSCodePageEncoding, UTF7Encoding,
                                         UTF8Encoding, UTF32Encoding, and UnicodeEncoding.
    $ProgressPreference              Continue       (stop | Enquire | continue | SilentlyContinue)
    $PSEmailServer                   (None)
    $PSSessionApplicationName        WSMAN
    $PSSessionConfigurationName      http://schemas.microsoft.com/powershell/microsoft.powershell 
    $PSSessionOption                 (See below)
    $VerbosePreference               SilentlyContinue   (Write-Verbose) (stop | Enquire | continue | SilentlyContinue)
    $WarningPreference               Continue           (Write-Warning) (stop | Enquire | continue | SilentlyContinue)
    $WhatIfPreference                0

Examples

Display the value of the $ConfirmPreference variable.

PS C:\> $ConfirmPreference
High

Assign the value "Medium" to the $ConfirmPreference variable.

PS C:\> $ConfirmPreference = "Medium"

Setting $OFS (the Output Field Separator) to display an array with different separators:

PS C:\> &{ $a = 1,2,3; "$a"}
  1 2 3

PS C:\> &{ $OFS="-"; $a = 1,2,3; "$a"}
  1-2-3

"Democracy cannot be static. Whatever is static is dead" ~ Eleanor Roosevelt

Related:

Variables - Environment variables
Array Variables


© Copyright SS64.com 1999-2014
Some rights reserved