PowerShell: Accessing Environment Variables

Accessing environment variables via PowerShell is very simple. 🎬 I also created a video on this topic. Read an environment variable via the $Env: variable The simplest way is through the $Env: variable. Just type $Env, then a colon, and then the name of the environment variable whose value you want to read. 1 $Env:username This outputs the username of the currently logged-in user. ...

2024-02-28 · 3 min · Andreas Dieckmann