1

Possible Duplicate:
Windows equivalent of whereis?

I'm used to saying "which foo" on Unix systems to see what's going to run.

Today I'm having trouble with a program on Windows, and I think it may be the wrong command that's running. How do I determine, from cmd.exe, what program it's actually going to run when I type "foo"?

Ken
  • 2,919

4 Answers4

0

I would suggest, using your "foo" example, typing

foo /?

That should do similar on windows as adding --help does in linux. Not always, mind you, but it should let you know exactly what's going on, as well as some command syntax.

Aeo
  • 2,627
0

I don't know of a 'which' for Windows, but from the command line you can run path to see where it is looking for the files. I believe it searches the path in order and will run the first executable it finds.

Remember that CMD.EXE will also search the local directory for a program to run and I believe this takes precedence.

0

To expand on steve's answer, from %SYSTEM_ROOT% you can run an attrib search to see where 'foo' lives, then compare to the %PATH% to see which would execute first:

attrib /s foo.exe
...
echo %PATH%
warren
  • 10,322
0

The which that comes with Cygwin (http://cygwin.org) will run from cmd.exe and probably do what you want otherwise. Be aware that if you're looking for a .bat, you need to explicitly add the .bat, e.g., "which gorp.bat" will find gorp.bat, but "which gorp" will not.