On 20 May 2010 17:24:52 GMT,
(E-Mail Removed) (Cindy Parker) wrote:
>Ok, I know. In a batch file I can change environment variables temporarily (=for the
>current, remaining session) be entering e.g.
>
>set CLASSPATH=D:\newpath;%CLASSPATH%
>
>However these changes are not visible outside of the current session and furthermore they
>are lost after a reboot.
>
>Is there a(nother) way to change them PERMANENTLY from batch script?
>
>I can imagine that there is a way by a regedit or VisualBasic script or 3rd party cmdline tool.
>
>Again: I don't want to edit them manually e.g. in the "System" dialog in control panel.
>The change should take place on cmdline from a script
>
>Cindy
You can run a command line update to the registry from a script to
change the path that is stored there. You run it form the command line
or a batch file with a command like this:
C:\Windows\regedit.exe /s c:\myfile.reg
myfile has to contain a reg key in text format, something like this:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment]
"CLASSPATH"=".;C:\\Program Files\\Java\\jre6\\lib\\ext\\QTJava.zip"
Unfortunately that's not the key and value you want to set. It's
"PATH" and it's stored as a hex value, not text. So, creating the .reg
file to add would be a chore. If you want to set a fixed path for the
system, you could just set it manually, export the key to get the .reg
file you need, then use it in the future. But, if you need to add your
directory to the end of whatever is on the system currently, that
won't work.
I'd suggest you take a look towards the bottom of this page. There are
some other alternatives.
http://vlaurie.com/computers2/Articl...nt.htm#editing