Using ‘Where’ command to find location of file

When using the command line, your $PATH variable holds different paths to search when you enter a command. Today, I was using the Visual Studio 2008 command prompt, which has setup my $PATH variable to point at known locations relating to .Net and Visual Studio.

I could happily type in ‘sn’ in order to execute the program, however I had no idea where that exe lived and I needed the full path. I thought I would have to search using Windows, however I found that there is a ‘where’ command which will return you the full path for a command.

C:Program FilesMicrosoft Visual Studio 9.0VC>where sn
C:Program FilesMicrosoft SDKsWindowsv6.0ABinsn.exe

Surprisingly useful!!

3 thoughts on “Using ‘Where’ command to find location of file”

  1. Great find, thanks!

    It would have been nice if this tool was listed by the “help” command.

    Also, check out the description for the “pattern” argument (where /?). It has some useful features.

  2. The reason it is not on the help because it is part of VS:

    >where where
    C:Program FilesMicrosoft Visual Studio 8Common7ToolsBinWhere.Exe


Leave a Reply

Your email address will not be published. Required fields are marked *