System Variable Modification:

Files Related To This Document:

REG.EXE
SETX.EXE

EXTEND.CMD

For awhile, I've been searching for a way to distribute path / system variables updates on a machine for applications such as Perl, Visual Studio, and Java. I have finally found a process that I consider reliable and efficient.

For the record, here are some common ways to NOT do this correctly:

Scenario: Update Session Manager\Environment\Path in registry directly.

Cons: 1) You may be killing a path entry that you wanted or adding one you didn't want (Depending on the the machine you took the snapshot on vs. the machine your installing it on later). 2) If the user cannot start the program through cmd.exe immediately after the object distributes.

Senario: Exporting %PATH%;C:\NEWPROG to Session Manager\Environment\Path and Control Panel\Environment\Path

Cons: 1) The System Path should not contain network search drive letters or entries in the user path; Novell adds search drives for you in the Path memory namespace. (IE. The registry listed path will differ from the one you get when you type PATH in cmd.exe).


The system path is very important when a program requests a file and it cannot find it immediately.  Once putting the three above files in an accessible directory, any environment variable can be appended to using the following syntax:

CALL EXTEND.CMD VARIABLE "VALUE"

For example, if we wanted to add C:\PERL\BIN to the system path, we simply do:

CALL EXTEND.CMD PATH "C:\PERL\BIN"