set path variable permanently from batch file.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jsfgeeks
Posts: 1
Joined: 18 Mar 2010 03:14

set path variable permanently from batch file.

#1 Post by jsfgeeks » 18 Mar 2010 03:21

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

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

Re: set path variable permanently from batch file.

#2 Post by avery_larry » 19 Mar 2010 15:47

setx perhaps?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: set path variable permanently from batch file.

#3 Post by aGerman » 20 Mar 2010 12:32

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

Post Reply