Tuesday, December 16, 2008

"which" command for Windows using Powershell

"Code Assassin" has given a great way to use 'which' command (very popular in Unix and absent in Windows CMD prompt) in Windows using Powershell. If you are too lazy to go to his blog, here is the command,

($Env:Path).Split(";") | Get-ChildItem -filter sqlwb*

Here sqlwb is the command for which you want to know 'which' one will be used when executed, in short, location(s) of the command.

Surely there are better queries than this exists at the same place but above one simply works... rather works simply.
(at occations it gives more result than acutally it should give.. but you can easily figure out unwanted)

For other direct commands see: http://blog.stevex.net/powershell-cheatsheet/
It has nice collections for DOS commands and equivalent Powershell command.

No comments: