Today’s Tip…

Getting environment variables in Windows has always been easy. Just bring up a CMD prompt and type ‘set’.


But what if I want to use an environment variable in Windows PowerShell? That’s easy too! Simply use ‘$env:<environment variable name>’. For example, if I wanted a variable that contains my computer name, I could use ‘$env:comptuername’ like this…


This will save me steps when scripting as I don’t have to query for my computer name and create a new variable for it. I can just use ‘$env:computername’. This works with all the environment variables.

Neat, huh?