Modify Path


Revision as of 22:02, 1 December 2011 by Uecasm (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search



Modify Path is a fairly simple Windows script that allows users to easily modify the system path by adding a new or removing an existing directory. It was written to facilitate installation of Inno Setup packages that require path changes.


Before you consider changing the PATH environment variable it's most likely worth to have a look at Avoiding the Path environment variable. Real world requirements for PATH changes are very rare if the application is written properly.

In general, the only real excuse for modifying the PATH is if you are installing command-line utilities for the user to run from arbitrary working directories. And even then, if the user will only need them on occasion, you should strongly consider writing a batch-shell [Icons] entry for them instead (similar to the Visual Studio Command Prompt).

Doing it Yourself

  1. Create a [Registry] entry to modify the PATH environment, using {olddata};{app} as the ValueData.
  2. Add a Check function to that entry, which reads in the same key and returns True only if {app} is not already present. (Ideally, via a case-insensitive comparison.)
  3. Do not use any of the unins* flags.
  4. Write some [Code] in CurUninstallStepChanged(usUninstall) which detects and removes {app} from the PATH, if present. (Again, preferably via a case-insensitive search and case-preserving replace.)
  5. Add the ChangesEnvironment=yes option.

See also

External links

Personal tools