Equivalent of *Nix 'which' command in PowerShell?

DevelopingChris picture DevelopingChris · Sep 15, 2008 · Viewed 108.5k times · Source

How do I ask PowerShell where something is?

For instance, "which notepad" and it returns the directory where the notepad.exe is run from according to the current paths.

Answer

halr9000 picture halr9000 · Sep 15, 2008

The very first alias I made once I started customizing my profile in PowerShell was 'which'.

New-Alias which get-command

To add this to your profile, type this:

"`nNew-Alias which get-command" | add-content $profile

The `n at the start of the last line is to ensure it will start as a new line.