How to Find and Reference Environment Variables in Windows PowerShell
In the classic Windows Command Processor, environment variables were referenced using “%” symbols surrounding the variable name. The environment variables were enumerated by simply typing “set” in the command prompt. This has changed considerably in PowerShell.
To find the currently set environment variables, open PowerShell and type the following:
Then to reference one of those items, simply append the “Name” value to $Env: in your command or script. E.g. type the following to change to the windows directory:
To elaborate on the options for the Get-ChildItem command, simply prepend it with “help”:
Follow the reactions below and share your own thoughts.