Find the location of an executable in Windows

goyun@dev C:\Users\goyun>where ping
C:\Windows\System32\PING.EXE

goyun@dev C:\Users\goyun>where powershell.exe
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

goyun@dev C:\Users\goyun>where powershell-ise.exe
INFO: Could not find files for the given pattern(s).

In powershell use where.exe, Get-Command (or its abbreviation gcm), as where is the default alias for Where-Object.
PS C:\Users\goyun> Get-Command powershell.exe

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     powershell.exe                                     10.0.19... C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe

PS C:\Users\goyun> gcm powershell.exe

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     powershell.exe                                     10.0.19... C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe


PS C:\Users\goyun> where powershell.exe
PS C:\Users\goyun> where.exe  powershell.exe
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Comments