1

I am working in a Windows XP Pro environment and I am wondering if there is a simple way to make a program be executable from any path in the command prompt. Are environmental variables needed? And if so, how can I add a path to the PATH environmental variable and have it be available anywhere?

Example:

From the cmd, I write echo %PATH% and it shows me the path of where my program is.. i.e. C:\ProgramFolder

However, I try to execute it on my desktop and it says the program name is not recognized as an internal or external command, operable program or batch file.

C:\Documents and Settings\me> program

(The executable program is in the folder ProgramFolder.)

Am I doing something wrong? Does the path need to be directed to the program itself vs the program folder??

Thanks.

O_O
  • 1,813

2 Answers2

3

First make sure the full path to the file is actually in the PATH environment variable (minus the file name of course, just the directory component). Once you add it, you will either need to restart the command shell you are typing in, or if you are trying to run it from a program launched by Explorer, you will need to reboot, or kill the explorer.exe process and start it again.

Environment variables don't auto-propagate correctly to running processes in Windows and there is no easy command like 'rehash' in UNIX to force them to.

3

Right-click My Computer, select Properties, and click the "Advanced" tab. Click the Environment Variables button. In the System Variables box, find "Path" and click the Edit button. Add a semicolon at the end of the text in the variable value box and paste the complete path to the folder that contains the files you want to be available (C:\ProgramFolder).

Smurf64
  • 166