Ever wanted to pull an update from the TFS server for all workspaces you have without having to start up the Visual Studio? Well I did. Visual Studio is rather slow in starting up and then you have to navigate to the TFS explorer (clicky clicky) and manually update the workspaces (clicky clicky) and then wait till the whole thing is done and VS becomes responsive again (waity waity).
You have the
tf.exe command which you can use from a command prompt, but that requires you to use the VS command line because the right paths are set there. You could set the paths so they are available in all your shells, but that’s not very handy either.
I just wanted a batch script that I could run from any shell, that would just update my workspaces for me. Nice and easy.
Like when I press CTRL-R in Windows (Run) and type
getfoo.cmd<enter>, it just makes it all happen for me.
So here’s how I did that:
@echo off cls :: Importing VS 2012 command line variables so we can run TF.exe if exist "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat" ( echo Importing VS 2012 environment variables... setlocal call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat" ) echo. echo *** Updating TFS workspaces *** echo. :: Repeat this for all workspaces you want to update. d: cd D:\WS\pathtosolutionfiles\ tf get . /version:T /recursive echo. echo *** Workspace updated. *** echo.