Skip to content

Instantly share code, notes, and snippets.

@catwhocode
Created November 23, 2021 15:41
Show Gist options
  • Save catwhocode/ab20f12f7e5ff16349d719001f914241 to your computer and use it in GitHub Desktop.
Save catwhocode/ab20f12f7e5ff16349d719001f914241 to your computer and use it in GitHub Desktop.
Add new entry to the path environment variable
# source:
# https://stackoverflow.com/questions/17240725/setx-doesnt-append-path-to-system-path-variable/17247259
$new_entry = 'd:\app'
$old_path = [Environment]::GetEnvironmentVariable('path', 'machine');
$new_path = $old_path + ';' + $new_entry
[Environment]::SetEnvironmentVariable('path', $new_path,'Machine');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment