CmdID / PowerShell / Cmdlets / Get
Get-Variable
Gets the variables in the current console. PowerShell reference
From the PowerShell reference
5 parameters
Alias gv
What it does
Gets the variables in the current console. The Get-Variable cmdlet gets the PowerShell variables in the current console. You can retrieve just the values of the variables by specifying the ValueOnly parameter, and you can filter the variables returned by name.
Get-Variable [[-Name] <String[]>] [-ValueOnly] [-Include <String[]>] [-Exclude <String[]>] [-Scope <String>] [<CommonParameters>]
Get variables by letter
Get-Variable m*IdentifyGet variable values by letter
Get-Variable m* -ValueOnlyIdentifyGet variables by two letters
Get-Variable -Include M*,P*IdentifyGet variables by scope
Get-Variable -Scope 0
Compare-Object (Get-Variable -Scope 0) (Get-Variable -Scope 1)IdentifyIts page in the reference: Get-Variable.
Parameters
-ExcludeSpecifies an array of items that this cmdlet excludes from the operation. Wildcards are permitted.-IncludeSpecifies an array of items upon which the cmdlet will act, excluding all others. Wildcards are permitted.-NameSpecifies the name of the variable. Wildcards are permitted. You can also pipe a variable name to Get-Variable.-ScopeSpecifies the variables in the scope.The acceptable values for this parameter are:
- Global
- Local
- Script
- A number relative to the current scope (0 through the number of scopes, where 0 is the current
scope and 1 is its parent)
Local is the default. For more information, see about_Scopes.-ValueOnlyIndicates that this cmdlet gets only the value of the variable.