PowerShell includes a variable provider that can be queried as a filesystem using Get-ChildItem, Test-Path, and so on.
Get-ChildItem may be used to list all of the variables in the current scope by running the command shown as follows:
Get-ChildItem variable:
The output will include the default variables, as well as any variables created by modules that might have been imported.
As this behaves much like a filesystem, Test-Path may be used to determine whether or not a variable exists:
Test-Path variable:\VerbosePreference
Set-Item may be used to change the value of a variable or create a new variable:
Set-Item variable:\new -Value variable
Get-Content can also be used to retrieve the content of a variable:
Get-Content variable:\OutputEncoding
The backslash character used in the preceding examples is optional. The output from each command in the following example...