Permanent environment variable change

From MicroFocusInternationalWiki
Jump to: navigation, search

Permanent environment variable change

I want the changes to be permanent

I am trying to update the Path environment variable on Windows 2000 machines through Zenworks. I want the changes to be permanent. I need to delete one path, and add two more. I have tried making an application object and putting the two paths to be added in the 'Environment variables' section - appending to the 'Path' variable with a ; separator. I checked the Path value, and it had not been updated. Any thoughts on how this can be done? Thanks!


The Microsoft setx.exe utility, which have from the Windows NT 4.0 resource kit, allows you to change an environment variable from a command line such that it will survive a reboot. The version I have (1.0a 5/31/96) appears to work fine on Windows XP Tablet SP2 and Windows 2000. However, it does appear that it was also part of the Windows 2000 resource kit, and you can download it from

After you have the utility, you could have a NAL object execute something like
setx Path %Path%;newpath1;newpath2
to do what you requested.


I need some help on rearranging the PATH environment variable permanently.

I need to have a certain directory path ahead of another directory in the PATH variable.I have two exe's (say test.exe) with the same name in two directories say C:\temp1 and C:\temp2 and I would like the test.exe in C:\temp2 to be executed instead of the one in C:\temp1.C:\temp1 is ahead of C:\temp2 as of now. I need to move C:\temp2 ahead of C:\temp1.I do not intend to delete C:\temp1.

I need to do this from a command line and that too permanently. It is on Windows 2003 Server that I am trying.

I tried with SETX as below but I could only add additional path to the end of the existing PATH variable. eg;setx path "%path%;C:\temp2".

Is it possible to add a directory path to the beginning of the PATH variable. I have also tried setx path "C:\temp2;%path%" which made the entire PATH variable append to the existing PATH variable but did not add C:\temp2 to the beginning of the PATH variable.

As you might know,SET command allows to do string substituion(SET %PATH%:str1=str2%). I could not find similar syntax with SETX from help.

Could you please help me in this regard.

Is VBScript the only solution? If so could you please refer to some existing scripts which do this job.

Thanks in advance, Rohini Chandra.