I need to show TFS history of a file on the command line so I can redirect to a text file.

by Donovan Brown 13. September 2011 19:17

Problem:

When I run the tf history command from the command line it shows a dialog box.

Solution:

Add the /noprompt option to the TF History command. This will cause the output to be shown in the command window. You can then use DOS redirection to easily store the results in a text file.

For example:


tf history $/MyProject/Main/Source /recursive /noprompt /format:detailed /collection:http://MyTFS:8080/tfs/defaultcollection > history.txt

This will result in a new file called history.txt to be created in the working folder.

Explanation:

The key to not showing the dialog box is the /noprompt.  If you leave off the /noprompt you will be shown a dialog box.


The output redirection operator > is used to send the command output to somewhere other than the screen for example a text file.


> somefile.txt (If the file already exists it will be overwritten.)
>> somefile.txt (This will append a file. If the file does not already exist it will be created.)

Tags: , ,

Work

About the author

My name is Donovan Brown and I am a Technology Specialist for DevTools with Microsoft with a background in application development.  I also run one of the Nation’s fastest growing online registration sites for motorsports events DLBRacing.com.  When I am not writing software I race cars for fun.  DLBRacing.com has given me the opportunity to combine my two passions writing software and racing cars.

AdSense

Month List

AdSense