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.

2
  • In order to be able to start an executable from everywhere, it has to be within a folder that is on the PATH. For your questions about setting the PATH and environment variables, see here: superuser.com/questions/284342/…
    – slhck
    May 18, 2011 at 21:55
  • You write "From the cmd, I write echo %PATH% and it shows me the path of where my program is.. i.e. C:\ProgramFolder" You are not being accurate. Maybe there's an error in your path. You should paste into your post exactly what ECHO %PATH% shows.
    – barlop
    May 19, 2011 at 0:25

2 Answers 2

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .