As I sometimes have path problems, where one of my own cmd scripts is hidden (shadowed) by another program (earlier on the path), I would like to be able to find the full path to a program on the Windows command line, given just its name.
Is there an equivalent to the UNIX command 'which'?
On UNIX, which command
prints the full path of the given command to easily find and repair these shadowing problems.
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.
When multiple open windows, files, or tabs are open, press Ctrl + F4 or Ctrl + W in Windows ( Command + W on a Mac) to close them one at a time without closing the program. In Microsoft Windows, programs that support Ctrl + W can also use the shortcut Ctrl + Shift + W to close all open tabs.
Alt+F4 (or type “exit” at the prompt): Close the Command Prompt.
Windows Server 2003 and later (i.e. anything after Windows XP 32 bit) provide the where.exe
program which does some of what which
does, though it matches all types of files, not just executable commands. (It does not match built-in shell commands like cd
.) It will even accept wildcards, so where nt*
finds all files in your %PATH%
and current directory whose names start with nt
.
Try where /?
for help.
Note that Windows PowerShell defines where
as an alias for the Where-Object
cmdlet, so if you want where.exe
, you need to type the full name instead of omitting the .exe
extension. Alternatively, you can set an alias for it:
Set-Alias which where.exe
Update: Using Get-Command
(alias: gcm
) is recommended since it's native to PS and will get all command types: aliases, cmdlets, executables, and functions. Example:
gcm notepad*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With