TIP: Control your system PATH variabe!

By jobeard
Aug 11, 2012
Post New Reply
  1. Here's the issue:

    When an application asks for program XXX, the system searches the SYSTEM PATH to find it. The sequence of locating XXX goes like this:​
    • The exact location requested (if any), eg ..\thisDir\XXX (this would have to be hard coded in the code itself)
    • The current directory, eg .\xxx (this and the next are the default behaviors)
    • The system Path variable, which is a LIST of directories
    That PATH Variable changes almost with every install, or at least with every Application installed. This gives rise to fraudulent and/or multiple XXX modules on the system.

    Here's the cause:

    Programmers are lazy, just like you & I and when they create an Installer Package,​
    the System Path sometimes needs to include the install location. The easiest method to​
    add the new install path is​

    PATH = $newpath;$PATH​

    I just installed PERL on my Win/7 64bit system and the new path var looks like this:​

    C:\PERL64\SITE\BIN;C:\PERL64\BIN;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;...​

    Here's the fix:

    Use an ADMIN login and edit the SYSTEM PATH so as to keep​

    C:\windows\SYSTEM32;C:\windows;

    at the beginning of the path and move the new install at least AFTER the system directories:​

    C:\windows\SYSTEM32;C:\windows;C:\PERL64\SITE\BIN;C:\PERL64\BIN;\...

    I've been using this technique since Win98 to ensure that system modules can not be overridden (at least by careless path manipulations).


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.