Freigeben über


TFS Command Line Katas: Part 1 – Basic TF.exe Concepts

The TFS command line client, tf.exe, is a powerful tool that may be somewhat intimidating or elusive to learn if you primarily work through within Visual Studio.  In fact, you can do many things in tf.exe that are not available through the Visual Studio source control interface.  tf.exe has been around since the earliest days of Team Foundation Server 2005, yet many developers don’t even know it exists.

To help you become more familiar with it, I’ll be blogging a short series of katas – small exercises you can repeat over and over until you’ve mastered the interface.  Today, I present the first kata – basic tf.exe commands.

Getting Started:

In order to use these katas, you’ll need to first do the following:

  1. Open the Visual Studio command prompt: Start –> All Programs –> Microsoft Visual Studio 2010–> Visual Studio Tools –> Visual Studio Command Prompt.  This will ensure that tf.exe is in your %PATH% environment variable so you don’t have to type the full path to it each time you use it.
  2. cd into a folder where you have an existing TFS workspace mapped. This is how tf.exe will know what workspace and server to work against.

 

TFS Command Line Kata #1 – TF.EXE Basics

My first kata introduces some of the most used commands in the command line client.  In particular, all of these can work without any additional parameters other than the command name.  I’ll address more complex commands in future posts.

  1. tf /? – list all available tf.exe commands
  2. tf workspace – view details about the current workspace
  3. tf workfold – view a list of server folders and the local folders they’re mapped to for the current workspace
  4. tf workspaces – view a list of all workspaces on the current machine
  5. tf dir – view a listing of files & folders in the source repository folder mapped to the current local folder
  6. tf status – view pending changes in the current workspace

That’s enough for now.  Remember, katas are short and simple, easy to memorize and repeat daily.  Work on these for a few days while I prepare the next post in the series.  If you have questions about the command line interface to TFS, please post comments.

Comments

  • Anonymous
    July 06, 2010
    The comment has been removed
  • Anonymous
    July 06, 2010
    The comment has been removed
  • Anonymous
    November 03, 2010
    The comment has been removed
  • Anonymous
    November 03, 2010
    Br. Bill: Can you elaborate?  If your current working directory is a mapped folder then tf.exe will work within the context of that workspace.  What are you trying to do that requires several commands with tf.exe that only takes one with other source control systems?