Skip to content

Instantly share code, notes, and snippets.

@ferventcoder
Created April 4, 2012 21:14
Show Gist options
  • Save ferventcoder/2305721 to your computer and use it in GitHub Desktop.
Save ferventcoder/2305721 to your computer and use it in GitHub Desktop.
Somebody's where.exe implementation as powershell ;)
$exe = 'git';
if($exe.EndsWith('.exe') -or $exe.EndsWith('.bat')) { $exe = $exe.Substring(0, $exe.Length - 4)}; (ls env:\path).Value.split(';') | %{ if( test-path "$_\$exe.exe" ) { ls "$_\$exe.exe" }; if( test-path "$_\$exe.bat" ) { ls "$_\$exe.bat" }; } | %{ if($_.FullName.EndsWith('.exe') -or $_.FullName.EndsWith('.bat')) { $_.FullName } }
@ferventcoder
Copy link
Author

Can you edit it? I shared it with no one...so it's more hiding in the open than public

@staxmanade
Copy link

Ok, give my fork a shot... :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment