Things I Learned Today #1 – where.exe have you been all my life?

Since my memory isn’t what it used to be, I’m going to start blogging anything cool I learn on a given day. Even if nobody reads this it will be a good way for me to create a hit list of cool solutions to problems.

Today’s mad man is the where command on Windows. Here is the description of the command:

[blockquote source=”Command-line help”]Displays the location of files that match the search pattern. By default, the search is done along the current directory and in the paths specified by the PATH environment variable.[/blockquote]

So why am I so excited about this?

A co-worker was trying to generate service references in a script and wanted to do it in the same way as Visual Studio 2013. He had found svcutil.exe in an SDK directory but when executing it the resulting output wasn’t what he expected. I suspected that it wasn’t the same svcutil.exe that Visual Studio was using and wanted a way to detective out the right one. After a little bit of Google-Fu, I found this post on Stack Overflow. I opened up the Visual Studio 2013 Command Prompt and typed the following command:

[blockquote source=”Command Prompt”]

C:Windowssystem32>where svcutil.exe
C:Program Files (x86)Microsoft SDKsWindowsv8.0AbinNETFX 4.0 ToolsSvcUtil.exe
C:Program Files (x86)Microsoft SDKsWindowsv7.0ABinSvcUtil.exe

[/blockquote]

The results show anywhere that svcutil.exe exists based on the PATH variable used by the command prompt.

I used this svcutil.exe and BOOM! The resulting service references were the same as what is produced by Visual Studio 2013.

2 thoughts on “Things I Learned Today #1 – where.exe have you been all my life?

Leave a comment