Archives for : January2015

PowerShell which

One thing that quickly annoyed me was typing ‘which’ in my powershell console and getting an error:

Why would I even want that? Because sometimes it’s important to know exactly how the console resolves what you type, especially when some items are in the path multiple times, and some can be obscured by new or other definitions.

Take Ruby. Ruby comes with “ri”, the documentation browser. Turns out in powershell there’s also an alias “ri”¬†for Remove-Item.

The good news is that Get-Command does basically what I want. So a quick addition to my profile:

and I now have my own ‘which’ command:

I can easily find out how to invoke the Ruby “ri” command, without it becoming Remove-Item: