Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Linux, we have the "which" command to find out the path of an executable.
What is its Windows equivalent? Is there any PowerShell command for doing that?

share|improve this question

migrated from Nov 6 '10 at 0:38

This question came from our site for professional and enthusiast programmers.

See also… –  ysap May 8 at 10:17

3 Answers 3

Some versions of Windows (I think Windows 2003 and up) have the where command:

c:\>where ping
share|improve this answer
where work for me in Windows 7 –  Nam G VU Oct 10 '11 at 16:30
This only works in cmd, not in PowerShell (in my experience) –  Thomas Oct 13 '14 at 15:15
where /r c:\ fileName adding the /r c:\ allowed me to perform a recursive search starting at the root of the C drive using Windows 7 Professional it seems to not be in… –  CrandellWS Sep 25 at 9:09

Yes, Get-Command will find all commands including executables:

PS\> Get-Command ipconfig

If you want to limit the commands to just executables:

PS\> Get-Command -CommandType Application

Will find all exes in your path. There is an alias for interactive use:

PS\> gcm net* -CommandType Application

To get the path of an executable, you can use the Path property of the returned object. For example:

PS\> (Get-Command notepad.exe).Path

For more info, run man Get-Command -full.

share|improve this answer

In addition to user10404, the help command will work on aliases, so you can use the same command name (gcm) for help and interactive use:

help gcm -Parameter *
# or
man gcm -Par *
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.