0

Is there any simple way to get the full directory of an exe that the windows is mapping though the PATH environment variable?

Something like:

C:\>whereis myexe
dcarneiro
  • 6,950
  • 11
  • 48
  • 74

3 Answers3

1

Have a look at this answer. You could turn the script shown here into a batch file that would work as you have suggested in your question:

Find the path of notepad.exe and mspaint.exe

Also, the Where commmand in Windows 7 does this:

where myexe.exe
Community
  • 1
  • 1
Raul Marengo
  • 2,217
  • 1
  • 14
  • 9
0

You can create this batch file and give the exe file as argument

@setlocal
@set P2=.;%PATH%
@for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT "%%~$P2:i"=="" echo %%~$P2:i
GuZzie
  • 954
  • 1
  • 6
  • 23
0

You are looking for the UNIX "which" command. Here's a windows version:

http://pankaj-k.net/weblog/2004/11/equivalent_of_which_in_windows.html

Chris
  • 4,073
  • 33
  • 35