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.

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:

program

Rather, I have to type in:

program.exe

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?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

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!

share|improve this answer
    
Perfect. Thank you for the answer. –  ShaChris23 Feb 11 '10 at 22:05
add comment
C:\>set pathext
PATHEXT=.COM;.EXE;.CMD;.BAT;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PCS1

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

share|improve this answer
    
It's a bit strange copy is built-in and help is not. –  grawity Feb 12 '10 at 13:16
add comment

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.