Welcome to MSDN Blogs Sign in | Join | Help

Find Path of a Command Line Tool

Many times you work on different machines, execute a command line tool but often wonder where that tool is actually installed. One way to figure this out is to look at all environment PATH variables and search them manually in same order as Windows does. But you don’t have to because luckily there is a little known built-in command called WHERE that does that for you:

image

This is similar to Unix commands like WHICH and WHEREIS.

Published Thursday, October 29, 2009 4:06 PM by shitals

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Thursday, October 29, 2009 5:48 PM by Josh Einstein

# re: Find Path of a Command Line Tool

And for those who didn't just step out of a time machine from 1990, here's two alternatives for PowerShell. :)

# started doing this

function WhereIs {

 Join-Path ($Env:Path.Split(";")) ($args[0]) -resolve -ea 0

}

whereis notepad.exe

# then realized I could just do...

get-command notepad.exe

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker