Last active
June 18, 2021 17:05
-
-
Save kumarharsh/96b36ae817b56df391071b310831b4a5 to your computer and use it in GitHub Desktop.
[Powershell] Update Environment Variable one-liner
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
# These snippets provide a quick way to update your environment variables | |
# directly from your powershell console. Just copy paste these lines, or | |
# even better, add it to your profile as functions. | |
# refreshing env in current shell | |
$env:path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") | |
# adding path to env | |
# set path in the $_newPath variable, and it'll get set to your user environment path and persisted. | |
$_newPath=""; [System.Environment]::SetEnvironmentVariable("Path", [System.Environment]::GetEnvironmentVariable("Path", "User") + ";${_newPath}", "User") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment