1

I have multiple active path, and when I run the following line

c:\> myProg.exe 

myProg.exe executes, but I have no idea where it is actually located.

Is there any command line tool that can help me reverse look up the physical folder where myProg lives?

1

2 Answers 2

2

very simple just

where myprog.exe 

for example

where ping 

result:

C:\Windows\System32\PING.EXE 
Sign up to request clarification or add additional context in comments.

5 Comments

Unfortunately, WHERE lists all paths that match - it does not tell you which one will actually execute. Also, it does not recognize internal commands.
hello @dbenham always exist simple way your bat file very complex Start-Process -PassThru powershell.exe | Get-Process -Module this simple powershell script run " process " get-process and child process
But what if you want the answer without actually running the command. The command has the potential to be destructive, or perhaps it is a resource hog. Part of the complexity of my batch script is to get the answer without actually running the command (except for using the help option of internal commands). Also, my script is explicitly intended for the CMD.EXE environment, thus its ability to detect internal commands.
@dbenham the question is where it is actually located the where command locate the exe file is not complete answer ? i just try solve his problem that involved to find exact location of exe file not more for more get child process use last script i comment that
Relax, it is a good answer. I'm just pointing out some limitations.
1

You can locate the application full path using:

for %i in (ping.exe) do @echo.%~$PATH:i 

1 Comment

This will fail to detect files in the current directory (unless the current directory is also within PATH). Also, this cannot recognize internal commands.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.