Last active
December 24, 2015 10:19
-
-
Save codingoutloud/6782961 to your computer and use it in GitHub Desktop.
Implements the Unix shell 'which' command using PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Implements the Unix shell 'which' command using PowerShell. | |
original: https://gist.github.com/codingoutloud/6782961 | |
#> | |
function WhichOnes | |
{ | |
if ($args.Count -eq 0) | |
{ | |
# obviously use of 'which' in usage text is a hack (since it is chosen to match the alias) | |
Write-Host "usage: which [cmd1] [cmd2] ..." | |
} | |
else | |
{ | |
Get-Command $args -All -ErrorAction SilentlyContinue | Format-Table Definition | |
} | |
} | |
New-Alias which WhichOnes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PowerShell 'which'
original is here
Implements the Unix shell 'which' command using PowerShell.
Usage
_which grep_ -- lists paths to any existing grep commands available.
To add to your PowerShell environment
Troubleshooting