Page 1 of 1

set path variable permanently from batch file.

Posted: 18 Mar 2010 03:21
by jsfgeeks
Hi,

I am installing JDK silently from batch file. So, after installation of JDK completed successfully, I want to add path of JDK\bin to the environment variable (path).

I am using set path command to set the path, but it accepts the java command till the session of that batch file. But, I want to set the path of JDK to the path variable, permanently.

Is there any way to do this?

Thanks in advance,
JSF GEEKS

Re: set path variable permanently from batch file.

Posted: 19 Mar 2010 15:47
by avery_larry
setx perhaps?

Re: set path variable permanently from batch file.

Posted: 20 Mar 2010 12:32
by aGerman
Have a look to the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

REG ADD could help you. Something like:

Code: Select all

REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "Path" /t "REG_MULTI_SZ" /d "%path%;C:\Program Files\java\jdkXXX\bin" /f