Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Expand Environmental Variables with PowerShell

$
0
0

Summary: Learn to expand the value of environmental variables by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find the value of a common environmental variable
           such as %username% or %computername%?

Hey, Scripting Guy! Answer Use the ExpandEnvornmentalVariables static method from the
           System.Environment .NET Framework class, for example:

[System.Environment]::ExpandEnvironmentVariables("%username%")

[System.Environment]::ExpandEnvironmentVariables("%computername%")


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>