Real TFS Command Line Help


John Lyon-Smith, a developer on my team, put togther this extensive command line help for Team Foundation's TF.exe command.  In his own words...

After the umpteenth time of typing “tf –?” only to have it launch the MSDN documentation that usually isn’t installed in my Dogfood environment, I threw together a text file that contains the sort of memory jogging help that I (and probably others) would like to see printed in the console (hint hint).  I thought it would be nice to share it.

Handy Text Files
tfhelp.txt       120 Character Width
tfhelp80.txt   80 Character Width

Thanks John!

COMMANDS

Add        tf add itemspec [lock:none|checkin|checkout] [/type:filetype]

              [/noprompt] [/recursive]

Branch     tf branch olditem newitem [/version:versionspec] [/noget] [/lock]

              [/noprompt] [/recursive]

Branches   tf branches [/s:servername] itemspec

Changeset  tf changeset [/comment:comment|@commentfile] /s:servername

              [/notes:("NoteFieldName"="NoteFieldValue"|@notefile)] [/noprompt]

              ([/latest]|changesetnumber)

Checkin    tf checkin [/author:authorname] [/comment:("comment"|@commentfile)]

              [/noprompt]

              [/notes:("Note Name"="note text"|@notefile)]

              [/override:reason|@reason] [/recursive] filespec ...]

Checkout   tf checkout|edit [/lock:(none|checkin|checkout)] [/recursive]

              [/type:encoding] itemspec

Configure  tf configure pathtoproject /server:servername

Delete     tf delete [/lock:(none|checkin|checkout)] [/recursive] itemspec

Difference tf difference itemspec [/version:versionspec] [/type:filetype]

              [/format:(visual|unix|ss)] [/ignorespace]

              [/ignoreeol] [/ignorecase] [/recursive] [/options:"options"]

           tf difference itemspec itemspec2 [/type:filetype]

              [/format:(visual|unix|ss)] [/ignorespace] [/ignoreeol]

              [/ignorecase] [/recursive] [/options:"options"]

           tf difference [/shelveset:[shelvesetowner;]shelvesetname]

              shelveset_itemspec [/server:serverURL]

              [/type:filetype] [/format:(visual|unix|ss)] [/ignorespace]

              [/ignoreeol] [/ignorecase] [/recursive] [/options:"options"]

           tf difference /configure

Dir        tf dir [/s:servername] itemspec [/version:versionspec] [/recursive]

              [/folders] [/deleted]

Get        tf get itemspec [/version:versionspec] [/all] [/overwrite] [/force]

              [/preview] [/recursive] [/noprompt]

Help       tf help commandname

History    tf history [/s:servername] itemspec [/version:versionspec]

              [/stopafter:number] [/recursive]

              [/user:username] [/format:(brief|detailed)] [/slotmode]

Label      tf label [/s:servername]  labelname@scope [/owner:ownername]

              itemspec [/version:versionspec]

              [/comment:("comment"|@commentfile)] [/child:(replace|merge)]

              [/recursive]

           tf label [/s:servername] [/delete] labelname@scope

              [/owner:ownername] itemspec [/version:versionspec]

              [/recursive]

Labels     tf labels [/owner:ownername] [/format:(brief|detailed)]

              [/s:servername] [labelname]

Lock       tf lock itemspec /lock:(none|checkout|checkin)

              [/workspace:workspacename] [/server:serverURL] [/recursive]

              [/noprompt]

Merge      tf merge  [/recursive] [/force] [/candidate] [/discard]

              [/version:versionspec]

              [/lock:none|checkin|checkout] [/preview] [/baseless] [/nosummary]

              source destination

Merges     tf merges [/s:servername] [source] destination [/recursive]

Permission tf permission [/allow:(* |perm1[,perm2,…]]

              [/deny:(*|perm1[,perm2,...])]

              [/remove:(* |perm1[,perm2,...])]

              [/inherit:yes|no] [/user:username1[,username2,…]] [/recursive]

              [/group:groupname1[,groupname2,...]]

              [/server:servername] itemspec

Properties tf properties [/recursive] itemspec

Rename     tf rename [/lock:(none|checkout|checkin)] olditem newitem

Resolve    tf resolve itemspec [auto:(AcceptMerge|AcceptTheirs|AcceptYours)]

              [/preview]

              [(/overridetype:overridetype | /converttotype:converttype)]

              [/recursive]

Shelve     tf shelve [/move] [/replace] [/comment:(@commentfile|"comment")]

              [/recursive] shelvesetname[;owner] filespec

           tf shelve /delete [/server:serverURL] shelvesetname[;owner]

Shelvesets tf shelvesets [/owner:ownername] [/format:(brief|detailed)]

              [/server:serverURL] shelvesetname

Status     tf status itemspec [/s:servername]

              ([/workspace:workspacename[;workspaceowner]] |

              [/shelveset:shelvesetname[;shelvesetowner]])

              [/format:(brief|detailed)] [/recursive] [/user:(*|username)]

Undelete   tf undelete [/noget] [/lock:(none|checkin|checkout)]

              [/newname:name] [/recursive] itemspec[;deletionID]

Undo       tf undo [/workspace:workspacename   [;workspaceowner]]

              [/s:servername] [/recursive] itemspec

Unlabel    tf unlabel [/s:servername] [/recursive] labelname itemspec

Unshelve   tf unshelve [/move] [shelvesetname[;username]] itemspec

View       tf view [/s:servername] [/console] [/noprompt] itemspec

              [/version:versionspec]

WorkFold   tf workfold localfolder

           tf workfold [/workspace: workspacename]

           tf workfold [/s:servername] [/workspace: workspacename]

              repositoryfolder

           tf workfold [/map] [/s:servername] [/workspace: workspacename]

              repositoryfolder|localfolder

           tf workfold /unmap [/s:servername] [/workspace: workspacename]

              [/recursive] (repositoryfolder|localfolder)

           tf workfold /cloak (repositoryfolder|localfolder)

              [/workspace: workspacename] [/s:servername]

           tf workfold /decloak (repositoryfolder|localfolder)

              [/workspace:workspacename] [/s:servername]

Workspace  tf workspace /new [/noprompt]

              [/template:workspacename[;workspaceowner]]

              [/computer:computername] [/comment:("comment"|@commentfile)]

              [/s:servername]

           tf workspace /delete [/s:servername]

              workspacename[;workspaceowner]

           tf workspace [/s:servername] [/comment:comment]

              [/newname:workspacename] workspacename[;workspaceowner]

Workspaces tf workspaces [/owner:ownername] [/computer:computername]

              [/s:servername] [/format:(brief|detailed)]

              [/updateUserName:oldusername]

              [/updateComputerName:oldcomputername] workspacename

 

ITEMSPECS

  Can contain wildcards *, ? and #

  Can contain relative path parts . and ..

  Can reference file system or UNC paths mapped to a workspace or server

  paths (which start with $/). You can usually specify more than one

  file separated by spaces for an itemspec (useful for edit, add, delete

  commands)

 

VERSIONSPECS

  Date/Time         Dmm/dd/yyyy

  Changeset number  Cnnnnnn

  Label             Llabelname

  Latest version    T

  Workspace         Wworkspacename;workspaceowner

 

ALIASES

  /changeset  /G     /noprompt   /I

  /comment    /C     /owner      /O

  /computer   /M     /recursive  /R

  /delete     /D     /server     /S

  /force      /P     /slotmode   /X

  /format     /F     /template   /T

  /help       /?,/H  /user       /U

  /lock       /K     /version    /V

  /login      /Y     /workplace  /W

  /newname    /N    

 

Comments (15)

  1. Noah Coad on Real TFS Command Line Help. The Visual Studio Team System User Education blog on Why…

  2. Ah, I love cheat sheets! You can hang them up on a wall, and then look at them when you need to remember

  3. Raj says:

    Hi,

    I am new to TFS and am trying to write a command line command which will give me all files that have been checked in after a particular date or after a particular label.

    If you can throw some light here it will be really helpful.

    Thanks.

  4. Toby Martin says:

    The ‘history’ command is missing the ‘noprompt’ option.http://msdn.microsoft.com/en-us/library/yxtbh4yh(VS.80).aspx

    Great cheat sheet, very useful.

  5. Raj says:

    This cheat sheet is very help ful.

    Thanks!!!

  6. Ravi Sindhu says:

    How could I overwrite files in TFS using DOS commands?

    Thanks a ton in advance.

  7. Alv says:

    I just wanna say that when you try to do this:

    tf workfold /unmap [/s:servername] [/workspace: workspacename] [/recursive] (repositoryfolder|localfolder)

    with recursive…

    Unrecognized command option ‘recursive’ is the result.. I’m running SP1 as well.. go figure.. I can’t figure it out.. whats the deal?? did someone forget that part?

  8. sridhar.prasanna says:

    Not sure if this is the write place to post a question, but i am facing an issue with commandline args.

    I am using branching and  checkin functionality with the /login switch. But even after specifying the login switch, the TFS login dialogue still appears with the login id that has been specified in the command line, but appended with my local domain name in the front. So if i remove the domain name and enter the password, the command line execution is successful.

    When i give the command line with /noprompt switch, i believe because of above error , the execution is not successful. Am i missing something here?

  9. James Bristow says:

    Nice reference. One item I had trouble finding was build by date/time. While all references specify a date, I had not seen any examples specifying time. I believe any .NET compatible time specification can be contained in quotes after the "D". For example, /p:versionToBuild=D"02/16/2010 16:05:00" would be the correct property to specify a build of the source code at 4:05 PM on 16 Feb 2010.

  10. James Bristow says:

    The above should have read /p:versionToGet=D"02/16/2010 16:05:00"

  11. Sanjay says:

    What is a commnad to get  "LastGoodBuildNumber"

  12. Umar says:

    This is just stupid. You can get this just by typing /?. What people need are EXAMPLES!

  13. /force says:

    I'm having a hard time finding any information on the /force switch with the checkin command, any ideas where to find information about it?

  14. Rajesh says:

    Hi,

    I am new to TFS. I tried to write command line to get files/folders from one TFS (offshore) to another TFS (onsite).

    In this case I am using two TFS server and both have different credentials.

    If any body help to how to get files and checkin another TFS server.

  15. Ravi says:

    is there any commond line options or API for finding the tfs build status?

Skip to main content