Powershell – Equivalent of *Nix ‘which’ command in PowerShell


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.

Best Solution

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.