How to Remove Environment Variables in PowerShell
To remove an environment variable in PowerShell for the current session, run Remove-Item on the Env: drive: That only affects the current window. To delete a variable permanently, use the .NET method with the User or Machine scope, which I cover below. I also show a change in PowerShell 7.5 that trips up older scripts. … Read more