Follow us on X (Twitter)  Like us on Facebook  Connect with us on LinkedIn  Subscribe to our YouTube Channel  Subscribe to our WhatsApp Group

How to Check-In, Check-Out silently using commands in TFS?


Majority of the developers uses source control server as their project’s repository. SVN and TFS (Team Foundation Server) are one of them. If you are one of the user, you are already familiar with the Check-In and Check-Out process that we do from Team Explorer. In some case, you may need to do the same from command prompt. Today, this post will cover how to Check-Out and Check-In files/folders from command prompts. - Article authored by Kunal Chowdhury on .

Majority of the developers uses source control server as their project’s repository. SVN and TFS (Team Foundation Server) are one of them. If you are one of the user, you are already familiar with the Check-In and Check-Out process that we do from Team Explorer.

 

In some case, you may need to do the same from command prompt. Today, this post will cover how to Check-Out and Check-In files/folders from command prompts.

 

Visual Studio comes up with a command file named “TF.exe” which resides in the common IDE folder of the Visual Studio installation directory. If you want to check-out and check-in files or folders silently from the Team Foundation Server using commands, you have to be familiar with this TF.exe file.

 

Source Control ServerIf you are using Visual Studio 2008, you will find it under:

"X:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe"

 

If you are using Visual Studio 2010, you will find it under:

"X:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe"

 

If you are using Visual Studio 2012, you will find it under:

"X:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TF.exe"

 

 

Check-Out Files or Folders from Command Prompt

If you are looking for a way to silently check-out files or folders from command prompt (mostly we need this when writing a batch script), in the command prompt, enter the following command:

 

“C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TF.exe” checkout “COMPLETE_TFS_PATH” /recursive

 

I assume here that, you are using Visual Studio 2012 (version 11.0) and the Visual Studio instance is installed under “C:\Program Files (x86)” directory. In case, it differs, provide the proper path as mentioned above.

 

Provide proper path for “COMPLETE_TFS_PATH”, which could be a branch, specific folder or a file e.g. “$/Kunal-Chowdhury” or “$/Kunal-Chowdhury/Blog” or “$/Kunal-Chowdhury/Blog/default.html”.

 

Check-In Files or Folders from Command Prompt

Similarly, if you are looking for a way to silently check-in files or folders from command prompt (mostly we need this when writing a batch script), enter the following command:

 

“C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TF.exe” checkin “COMPLETE_TFS_PATH” /recursive

 

Again, I assume here that, you are using Visual Studio 2012 (version 11.0) and the Visual Studio instance is installed under “C:\Program Files (x86)” directory. In case, it differs, provide the proper path as mentioned above.

 

Don’t forget to change “COMPLETE_TFS_PATH”, which could be a branch, specific folder or a file e.g. “$/Kunal-Chowdhury” or “$/Kunal-Chowdhury/Blog” or “$/Kunal-Chowdhury/Blog/default.html”.

 

Get Files or Folders Recursively from Command Prompt

So, we learnt how to check-in or check-out files or folders to/from TFS. So, what about getting the latest version of the source code from Team Foundation Server? Yes, you can do that too from the command prompt and by using these commands, you can create different batch files and  process them silently in different need.

 

To get read only copies of files and folder from TFS recursively, enter the following command which will download them in the workspace folder:

 

“C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TF.exe” get “COMPLETE_TFS_PATH” /recursive

 

Don’t forget to change “COMPLETE_TFS_PATH”, which could be a branch, specific folder or a file e.g. “$/Kunal-Chowdhury” or “$/Kunal-Chowdhury/Blog” or “$/Kunal-Chowdhury/Blog/default.html”.

 

End Note

I hope that this post will help you in case you want to do some batch processing with your source control system to retrieve, check-out, check-in stuffs silently. This is mainly important when you are building a pre-build event or post-build event in your Visual Studio project properties.

 

Want to learn about it? Ok, we will discuss it someday in another blog post. Till then, enjoy learning and follow my blog for various articles & tips. I am available on Twitter and Facebook. Why don’t you connect with me and say a “Hello”? Have a great day! Enjoy your coding stuffs.

Have a question? Or, a comment? Let's Discuss it below...

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.