What I need to do:
- Append a folder to the
%PATH%
environment variable at the SYSTEM level. - Make the change permanent.
How I need to do it:
- Using the command prompt, or another method by which all necessary commands can be written to a
.BAT
file. - Using only tools which would be available on a bare install of Windows XP SP3, without Internet connectivity.
- I'd rather run the script locally, but I do also have remote access to the target systems. Bear in mind though, that I cannot presume any non-default services (i.e.: Remote Registry) are enabled on the systems.
Systems the script needs to work on:
- Windows XP SP3
- Windows Server 2003 SP2
- Windows 7 SP1
- Windows Server 2008 R2 SP1
I'm fairly familiar with the SET
command, but I'm also aware that it will generally overwrite the existing variable instead of append to it. That is not acceptable. Is there another tool (or option for SET
, which I'm unaware of) that will append to the variable instead? Or, do I need to put a work-around in the script that includes temporarily copying the existing variable to another variable or text file?
Also, it's my understanding that SET
will not permanently alter the variable. I've seen mention of SETX
, but that does not seem to come built-in to Windows XP SP3 (or, at least, it doesn't appear to be available on the system I'm working on). Is there another way to make the change permanent, via registry edit or something?
I've done some looking around and have learned a good bit from here about setting environment variables in Windows. However, I haven't yet found an exact duplicate question that will suit my needs. If there is one, please do let me know.
REG
to do registry changes. If you'd like to post that as an answer, with suggestions on how to retain the existing path, I'd at least give it an up-vote.