using TFS from the command line

a feature of many source contol systems (like CVS, Mercurial Hg, Git etc.) is that you can use them from the command line.

often this can be faster than ploughing through menus, or waiting for Visual Studio to open etc.
Well, luckily for MS TFS users, most tfs features are available from the command line.


opening a Visual Studio command prompt


1. Select the Windows Start button.
2. Type command.
Windows will retrieve a list of the available command prompts.
3. Select the appropriate command prompt, for whatever version of Visual Studio you are using.
4. change directory to be under a tfs source code base:
cd e:\projects\tfs12\myProject

You can now use the tf command, to control tfs.


using TFS from the command line

show currently checked out files (note this seems to be MUCH faster than performing the equivalent operation in Visual Studio!)
tf status


list labels:
tf labels

label the directory branch2012.1 with the label "branch2012.1.20120101"
tf label  branch2012.1 "branch2012.1.20120101

check out the file myProgram.cs:
tf checkout MyProject\myProgram.cs


check in the file myProgram.cs:
tf checkin MyProject\myProgram.cs

There are many other commands.
For help, just type tf and hit ENTER:
tf

Comments