Last active
June 7, 2019 10:52
-
-
Save manualbashing/bf53c33eb1c8a866a3b4 to your computer and use it in GitHub Desktop.
Working with environment variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ENV:PATH = $ENV:PATH + ";C:\Windows\System32" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#See all environment variables | |
Get-ChildItem Env: | |
#Alternative using .NET: | |
[Environment]::GetEnvironmentVariables() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the content of an individual variable: | |
$Env:USERPROFILE | |
#Alternative using .NET: | |
[Environment]::GetEnvironmentVariable("Userprofile", "Process") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Set environment variable via .NET for the scopes Process, User, Machine | |
[Environment]::SetEnvironmentVariable("USERPROFILE", "C:\Users\Administrator", "Process") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment