0

Let's say I have a foo.exe file that I want to use it from windows command prompt. I will go to the folder which contains foo.exe and run it. Now, if I want global access for foo.exe from anywhere in the command prompt I will put foo.exe in System32 folder.

This process makes System32 a dump ground. I was wondering if there are any other ways of globally accessing the .exe or bat files without having to dump all of them in System32 folder.

2 Answers2

3

Change your PATH environment variable. i.e. "set path=%path%;[newdir]"

where [newdir] is the new directory you want searched when you run commands.

The PATH Environment Variable

William Leara
  • 10,595
  • 4
  • 36
  • 58
  • 1
    You can also change the path on a windows machine by going to SystemProperties->Advanced->EnviromentVariables. At the top you have the user specific enviroment variables and at the bottom, the system wide ones. PATH can be in both. – Simon P Stevens Jun 16 '09 at 15:34
  • Note that the path size is limited (length depends on OS). If you have a few installed software that have added their folders to the path, it might overflow. The way to avoid that is to create a separate system variable, say FOOS_DIR, and assign foo's dir to it. Then, add %FOOS_DIR% to the system path instead of the actual path. – Eran Jun 16 '09 at 17:02
0

You can either do this programatically (StackOverFlow) or follow these instructions How to set the path in Windows 2000 / Windows XP, another one.

Community
  • 1
  • 1
merkuro
  • 6,161
  • 2
  • 27
  • 29