| Written by Diana, on 04-09-2007 02:31 |
| Views |
79  |
|
|
|
PS C:\Users\Admin> help gv -full
NAME Get-Variable
SYNOPSIS Gets the variables in the current console.
SYNTAX Get-Variable [[-name] <string[]>] [-include <string[]>] [-exclude <string[]>] [-valueOnly] [-scope <string>] [<CommonParameters>]
DETAILED DESCRIPTION Gets the Windows 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.
PARAMETERS -name &ln;string[]> Specifies the name of the variable.
Required? false Position? 1 Default value * (gets all variables in Variable:/) Accept pipeline input? true (ByValue, ByPropertyName) Accept wildcard characters? true
-include <string[]> Specifies only those items upon which the cmdlet will act, excluding all others. Wildcards are permitted.
Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? true
-exclude <string[]> Omits the specified items. Wildcards are permitted.
Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? true
-valueOnly <SwitchParameter> Gets only the value of the variable.
Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false
-scope <string> Limits the variables retrieved to the specified scope. The value can be a named scope: "global", "local", or "script", "private" or it can be a number relative to the current scope (0 through the number of scopes where 0 is the current scope and increasing the number ny 1 moves to the parent scope of the current scope).
Required? false Position? named Default value Local Accept pipeline input? false Accept wildcard characters? false
<CommonParameters> This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".
INPUT TYPE Object
RETURN TYPE Object
NOTES
This cmdlet does not manage environment variables. To manage environment variables, you can use the environment variable provider.
----------------- EXAMPLE 1 -----------------
C:\PS>get-variable m*
This command displays variables with names that begin with the letter 'm'. The value of the variables is also displayed.
----------------- EXAMPLE 2 -----------------
C:\PS>get-variable m* -valueonly
This command displays only the values of the variables with names that begin with the letter 'm'.
----------------- EXAMPLE 3 -----------------
C:\PS>get-variable -include M*,P* | sort-object name
This command gets information about the variables that begin with either the letter 'M' or the letter 'P'. The results are piped to the Sort-Object cmdlet, sorted by name and displayed.
RELATED LINKS Set-Variable New-Variable Clear-Variable Remove-variable
Last update: 04-09-2007 02:31
Users' Comments (0)
|
|
|