Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does powershell have an equivalent to the which command found in most (if not all) unix shells?

There are a number of times I'd like to know the location of something I'm running from the command line. In unix I just do which <command> and it tells me. I can't find an equivalent in Powershell.

share|improve this question

4 Answers

up vote 5 down vote accepted

This was asked and answered on Stack Overflow: Equivalent of *Nix ‘which’ command in Powershell?

share|improve this answer
Exactly what I was looking for. thanks! – Herms Sep 2 '09 at 19:17

Similar Powershell question was asked over at stackoverflow:

http://stackoverflow.com/questions/1362694/is-there-a-guide-to-the-somewhat-convoluted-powershell-syntax-example-with-biz/1362896#1362896

Some general guides linked to from that accepted answer:

share|improve this answer
function which([string]$cmd) {gcm -ErrorAction "SilentlyContinue" $cmd | ft Definition}
share|improve this answer

Also answered in 2008: Is there an equivalent of 'which' on windows?

Try the where command if you've installed a Resource Kit: http://ss64.com/nt/where.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.