The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,822 other followers

Find an installed tf.exe, then run it with the command-line parameters specified.

Posted by jpluimers on 2015/04/30

Often I want to execute a TF.exe from the console, but don’t have the Visual Studio environment variables setup. Most of the times I want to run TF.exe from the most current Visual Studio installation, hence this TF.bat file figures out the location of it, then runs with the parameters passed to TF.bat:

A few notes:

  1. I wasn’t sure from which Visual Studio version TF.exe was supported. I thought Visual Studio 2005 or 2008, but got confirmed it was Visual Studio 2005 (a.k.a. 8) by Love the elegance of F#. This code looks for the TFS Command line tool and returns Somepath or None.
  2. The Visual Studio names and version numbers are a mess, so I usually first look at the Wikipedia Microsoft Visual Studio History table.
  3. The same holds for many other numbers and registry paths.INFO: Visual Studio version numbers is of great help here.
  4. The base registry path depends if you are running on an x64 or x86 system I used the PROCESSOR_ARCHITECTURE  and PROCESSOR_ARCHITEW6432 environment variables to detect which bitness was running as described in HOWTO: Detect Process Bitness – David Wang – MSDN Blogs (I blogged about that before: Windows batch file to set ProgramFilesX86 directory for 32-bit program files on x86 and x64 systems via: Stack Overflow).
  5. Since I have no VM that has all these Visual Studio installations installed, reg query usually gives an error message. The 2^>NUL trick gets around that: Windows Batch: reg query key value to a variable but do not display error if key doesn’t exist – Stack Overflow.

–jeroen

via: Find an installed tf.exe, then run it with the command-line parameters specified.. PS:

This post supercedes using tf to list the workspaces for the current directory in Team Foundation System « The Wiert Corner – irregular stream of stuff.

One Response to “Find an installed tf.exe, then run it with the command-line parameters specified.”

  1. […] above tf-show-changeset-details-on-console.bat batch file uses tf.bat that hunts for the location of […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: