This is the built-in help made by Microsoft for the command 'Get-Variable', in PowerShell version 4 - as retrieved from
Windows version 'Microsoft Windows 8.1 Enterprise' PowerShell help files on 2016-06-23.
For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.
Gets the variables in the current console.
Get-Variable [[-Name] <String[]>] [-Exclude <String[]>] [-Include <String[]>] [-Scope <String>] [-ValueOnly] [<CommonParameters>]
The Get-Variable cmdlet gets the Windows PowerShell variables in the current console. You can retrieve just the values of the variables by specifying the ValueOnly pa
rameter, and you can filter the variables returned by name.
<
Online Version: http://go.microsoft.com/fwlink/p/?linkid=293979
Clear-Variable
New-Variable
Remove-Variable
Set-Variable
<
-------------------------- EXAMPLE 1 --------------------------
PS C:\>Get-Variable m*
This command gets variables with names that begin with the letter "m". The command also gets the value of the variables.
-------------------------- EXAMPLE 2 --------------------------
PS C:\>Get-Variable m* -Valueonly
This command gets only the values of the variables that have names that begin with "m".
-------------------------- EXAMPLE 3 --------------------------
PS C:\>Get-Variable -Include M*,P*
This command gets information about the variables that begin with either the letter "M" or the letter "P".
-------------------------- EXAMPLE 4 --------------------------
PS C:\>Get-Variable -Scope 0
PS C:\>Compare-Object (Get-Variable -Scope 0) (Get-Variable -Scope 1)
The first command gets only the variables that are defined in the local scope. It is equivalent to "Get-Variable -Scope Local" and can be abbreviated as "gv -s 0".
The second command uses the Compare-Object cmdlet to find the variables that are defined in the parent scope (Scope 1) but are visible only in the local scope (Scope
0).