Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from serverfault.com May 18 '11 at 21:52

This question came from our site for system and network administrators.

    
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 '11 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 '11 at 0:25

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.