Created
March 9, 2012 12:13
-
-
Save serbrech/2006265 to your computer and use it in GitHub Desktop.
powershell whereis first draft
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
function get-path{ | |
$env:path -split';' | |
} | |
function whereis | |
{ | |
$argument = $cmd, [string]$arguments = $args; | |
foreach ($item in get-path){ | |
foreach ($thing in gci $item -ErrorAction silentlycontinue){ | |
if($thing.Name.StartsWith($cmd + ".")){ | |
echo $item; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it's not 100%, but was good enough to find what I wanted. will maybe consider improving it...