The which command in Linux is used to identify the location of executables.
The where command is a Windows which equivalent in a command-line prompt (CMD).
In a Windows PowerShell the alternative for the which command is the Get-Command utility.
In this note i will show how to find paths of executable commands in Windows.
Cool Tip: Windows lsusb command equivalent in PowerShell! Read more →
Find Executables – Windows ‘which’ Equivalent
Find the location of an executable command using Windows command-line prompt (CMD):
C:\> where <commandName> - example - C:\> where systeminfo - sample output - C:\Windows\System32\systeminfo.exe
Find the path of an executable command using Windows PoweShell:
PS C:\> Get-Command <commandName>
- or -
PS C:\> where.exe <commandName>
ℹ️ Note that the where command doesn’t display any output when running in PowerShell. Use where.exe instead.
Thanks! It helped 😉
Didnt know “WHERE”
thanks
In PowerShell, get-command can be abbreviated as
gcm
like i.e.
gcm explorer
Helpful, thanks. I kept trying to use `where` in PowerShell. 🤦♂️
Thanks a lot