2

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?

2 Answers 2

4

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!

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

1
  • It's a bit strange copy is built-in and help is not. Feb 12, 2010 at 13:16

You must log in to answer this question.

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