Using The Path and Making Custom Program Libraries

If you write a simple script, or download a one component utility, where do you put your script or utility module? Generally, you can put it into any convenient folder on your system. It's your system, after all.

Having copied your script to any convenient folder, Windows has to know to search that folder for your script, when you try to run it. If you run "ipconfig", for instance, Windows looks into "C:\Windows\System32" to find program "ipconfig.exe". Windows knows to search that folder, because "C:\Windows\System32" is in the Path in Windows.

I don't recommend putting any custom files in "C:\Windows\System32", or in any of the other Windows folders, for several reasons. I setup a special folder, C:\Utility, where I put all of my scripts and simple utilities. Having setup and populated "C:\Utility" with several dozen useful programs, when I run one of these utilities from a command window, I like to simplify things a bit.

If I were to simply copy program "MyUtility.exe" into my utility programs folder "C:\Utility", then open a command window, I would expect to run MyUtility as "C:\Utility\MyUtility". Typing "C:\Utility\" gets pretty monotonous after a while. Fortunately, with Windows, you can tell the system to look into your custom program libraries, like "C:\Utility", for any command that isn't entered with a complete path.

The system Path variable contains a list of all system libraries, and you can add your libraries (folders) to the list.

Open the System wizard (either Control Panel - System, or My Computer - Properties), and select Advanced, then Environment Variables. In the System variables window, you'll find an entry for Path. Double click on the Path entry, and you'll get an "Edit System Variable" window, which contains the current value of Path. My current value, for instance, contains:


There are 3 default system entries in there, each separated by a ";".

  • %SystemRoot%\system32
  • %SystemRoot%
  • %SystemRoot%\System32\Wbem

With these three entries, any reference to any module without a specific path will cause the system to automatically search thru the listed folders in the path, in sequence, and load the first copy found of the named module. Remember %SystemRoot% is a system variable, which points to the folder where Windows is installed; in most cases, it's value will be "C:\Windows".

You want to add "C:\Utility" to the Path list. Just open the "Edit System Variable" window, hit the End key (please don't overtype the Path value with just "C:\Utility"!), and type ";C:\Utility". Then hit OK, and OK again.

The next command window that you open will use the new value of Path, and you can run your custom commands without having to type in the path of the custom library. Just be sure to add your custom libraries to the end of the list; you don't want system functions searching thru your libraries, before trying the default ones, and slowing the system down.

NOTE: If all of this is too much trouble for you, you're welcome to run each utility by specifying the complete path, as "c:\utility\myutility" for instance. I simply find it easier to run as "myutility". It's your dime.

For more information, see Microsoft Product Documentation: Path.

>> Top