Monday, January 28, 2013

Adding environment variable from commandline


Share at Facebook

You can add environment variable using the following command. Just change the TEST_ENV_VAR and it's value with your needs.


reg add HKEY_CURRENT_USER\Environment /v TEST_ENV_VAR /d "C:\evn\var\test" /f


This simple piece of code is very helpful when you are working withe batch(.bat) script.


Note: Make sure you are executing this under Administrator privilege. Otherwise it may not work.





No comments: