Skip to content

Instantly share code, notes, and snippets.

@Hashbrown777
Created February 9, 2020 08:14
Show Gist options
  • Save Hashbrown777/d3101059b25cf957f9f6a2ed7502b957 to your computer and use it in GitHub Desktop.
Save Hashbrown777/d3101059b25cf957f9f6a2ed7502b957 to your computer and use it in GitHub Desktop.
resets an environment variable to what it would be if you opened a new prompt
function resetEnv {
Set-Item `
-Path (('Env:', $args[0]) -join '') `
-Value ((
[System.Environment]::GetEnvironmentVariable($args[0], "Machine"),
[System.Environment]::GetEnvironmentVariable($args[0], "User")
) -match '.' -join ';')
}
@Hashbrown777
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment