Say I have a program called program.exe, and I want to run it from the command line. Assume further that I'm at the command prompt, and in the same directory as the program.exe

For some reason, I cannot run the program by typing:


Rather, I have to type in:


Then the program will run.

I'm not sure what I did that caused it to behave this way. Even the simple ping utility also requires me to type ping.exe.

Strangely, I tried typing "copy" and it still recognizes it. Or is that not an executable?


Copy is an inbuilt command, indeed.

I assume you're familiar with editing your PATH, however in the envronment variables menu, there's another one called "PATHEXT", which holds filetypes to execute without the extension (I used it to add ".py", to execute python scripts). Check to make sure .exe is in there. If not, I've never come across this before!

C:\>set pathext

When you run program, the command interpreter will look for program, program.com, program.exe, etc. If you've lost .exe from this list, that would explain what you're seeing.

copy is a built-in to the command interpreter, and not a separate .exe or .com. In other words, cmd.exe specially recognizes that word and handles copying itself, instead of calling another program. (As opposed to xcopy.exe, which is not a built-in command.)

  • It's a bit strange copy is built-in and help is not. – user1686 Feb 12 '10 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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