7

I want to set environmental variables permanently through a batch file. Is there a command to set Permanent Environmental Variable (other than SETX) for Windows XP service pack 3?

command SETX JAVA_HOME="C:\java\jdk-1.4" is not supported in my machine. It is Windows XP service pack 3.

akira
  • 61,009
  • 17
  • 135
  • 165
e.hunnigton
  • 85
  • 1
  • 2
  • 5

1 Answers1

9

Per user settings command line:

% reg add KEY  /v JAVA_HOME /t REG_SZ /d "C:\java\jdk-1.4"

For user only settings replace KEY with:

HKCU\Environment

For per machine settings replace KEY with:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

(Attention: there is a space in the last key, quote it with " !)

akira
  • 61,009
  • 17
  • 135
  • 165
  • hey can u tell me where can i find similar commands like this one. – e.hunnigton Apr 27 '10 at 05:38
  • 1
    define "similar". modifying the registry? thats not so similar to, lets say, deleting files. best way to find things is to have a problem and to search for an answer here on superuser and, if nothing fits, ask your next question – akira Apr 27 '10 at 06:03
  • hey hey thank. Got what i wanted. Good work. Saved the day.Thanks again. – e.hunnigton Apr 27 '10 at 08:40
  • @shyameniw you told akira suggestion done fine, please say your complete command. thanks – Sam Nov 12 '12 at 09:04
  • @MJM: the command is the one i posted. right there, 2nd line. – akira Nov 12 '12 at 10:34