how to set ENV variable in windows CMD line
Andrew Henderson
I'd like to set a temporary enviroment variable in windows CMD line, which in my word the windows shell. because it's for temporary usage, So I don't want to add a new enviroment variable system wise by clicking "my computer-->properies---" ...
by the way, the envrioment variable I'd like to set is http proxy, but I don't known the windows syntax for that. so if you happen to know it as well, please tell me and I'll apreciate you even more ...
3 Answers
To set a temporary or 'per session' environment varible from a command line you can use:
set ‹var name›=‹value>
Make sure your spacing is exactly as shown above, if you add a space between the equal sign the command will fail.
Check: Link for a nice tutorial and info on environment variables.
3If you are using PowerShell, then you need to use the $env prefix for creating an environment variable.
Here's an example:
$env:<var name> = '<value>' 1 SET VAR_NAME=valueSee the Microsoft Documentation for the details.