Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

how to set ENV variable in windows CMD line

Writer 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.

3

If 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=value

See the Microsoft Documentation for the details.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy