Skip to content

Instantly share code, notes, and snippets.

@glombard
Last active January 4, 2016 03:09
Show Gist options
  • Save glombard/8560019 to your computer and use it in GitHub Desktop.
Save glombard/8560019 to your computer and use it in GitHub Desktop.
Batch file to export the TFS history for each user individually using TF.EXE
@echo off
set from=2014-01-01
set to=2014-12-31
echo Exporting TFS History from %from% to %to%
where tf.exe
if errorlevel 1 call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"
set tfproject=$/proj/src
set tflogin=DOMAIN\user3,mypasswd
set tfcollection=http://192.168.1.10:8080/tfs/collection
tf history %tfproject% /version:D"%from%"~D"%to%" /user:* /format:detailed /noprompt /login:"%tflogin%" /collection:%tfcollection% /recursive > history.txt
goto :eof
@echo off
echo Exporting TFS History for each user...
where tf.exe
if errorlevel 1 call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"
call :get User1
call :get User2
call :get User3
goto :eof
:get
echo User: %1
set out=C:\temp\TFS-History-%1.txt
if exist "%out%" (
echo already exists...
goto :eof
)
tf history $/prog/src/ /user:%1 /format:detailed /noprompt /login:"DOMAIN\user3,mypasswd" /collection:http://10.20.30.40:8080/tfs/developmentlivecollection /recursive > %out%
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment