Special Variables
Powershell
Variable Type Description Example
[array] An array
[bool] Yes-no value [boolean]$flag = $true
[byte] Unsigned 8-bit integer, 0…255 [byte]$value = 12
[char] Individual unicode character [char]$a = "t"
[datetime] Date and time indications [datetime]$date = "12.Nov 2004 12:30"
[decimal] Decimal number [decimal]$a = 12 $a = 12d
[double] Double-precision floating point decimal $amount = 12.45
[guid] Globally unambiguous 32-byte [guid]$id =[System.Guid]::NewGuid()
identification number $id.toString()
[hashtable] Hash table
[int16] 16-bit integer with characters [int16]$value = 1000
[int32], [int] 32-bit integers with characters [int32]$value = 5000
[int64],[long] 64-bit integers with characters [int64]$value = 4GB
[nullable] Widens another data type to include [Nullable``1[[System.Dat
the ability to contain null values. It eTime]]]$test = Get-Date
can be used, among others, to $test = $null
implement optional parameters
[psobject] PowerShell object
[regex] Regular expression $text = "Hello World" [regex]::split($text, "lo")
[sbyte] 8-bit integers with characters [sbyte]$value = -12
[scriptblock] PowerShell scriptblock
[single], [float] Single-precision floating point number [single]$amount = 44.67
[string] String [string]$text = "Hello"
[switch] PowerShell switch parameter
[timespan] Time interval [timespan]$t = New-TimeSpan $(Get-Date) "1.Sep 07"
[type] Type
[uint16] Unsigned 16-bit integer [uint16]$value = 1000
[uint32] Unsigned 32-bit integer [uint32]$value = 5000
[uint64] Unsigned 64-bit integer [uint64]$value = 4GB
[xml] XML document

On Me

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License