tf command line response file
-
Wednesday, December 24, 2008 6:19 AMI've looked around and could not find this info. Is there a way to pass a list of files to the tf command line?
I'd like to do something like:
tf checkout @list_of_flies.lst
Thanks,
Ted
Answers
-
Friday, April 24, 2009 5:36 AM
Hello,
So it turns out that the line length problem was simple:
Filenames with spaces MUST BE QUOTED on the command line....
Obvious - I know - but hopefully this will help someone with the same problem.....
Thanks for the help,
Ted- Marked As Answer by Ted Nugent Friday, April 24, 2009 5:37 AM
All Replies
-
Wednesday, December 24, 2008 9:11 AMYou can use command files to batch a series of commands to TFS. Here's a reference to the command file documentation on MSDN: http://msdn.microsoft.com/en-us/library/1az5ay5c.aspx. That + wildcards might do the job for you.
-
Wednesday, December 24, 2008 6:13 PMThanks - but that looks like the inverse of what we need. But maybe we don't understand it.
According to the link, the arguments are passed on the command line. So if I have 1000 files to checkout (out of 10,000) I would pass 1000 files on the command line? Seems a bit tedious considering we have the file list already.
Maybe a better question to ask would be, given 1000 files out of a 10,000 file source repository, what's the fastest way to check them in/out across a wan link?
Running a tf command 1000 times is brutally slow (we're talking hours).
Thanks,
Ted -
Thursday, December 25, 2008 6:16 AM
Hello Ted,
Based on my understanding,
There are several ways we can try
1. TFS OM is a choice for your requirment.
We can write a simple TFS Version Control program.
Program open a file which records items needs to be handled.
Program check them out or doing other actions.
Here is a sample.
Basic Source Control Operations Sample
Creates a source file, checks it in, modifies the source file, checks it in again, then deletes the file.
Related links:
How to: Run Team Foundation Server SDK Samples
Source Control Extensibility
2. Write a program to invoke tf command, pass each items to tf command, pass a long string containing many items as the parameter.
Good luck.
Please mark the replies as answers if they help and unmark them if they provide no help- Edited by Hua Chen Thursday, December 25, 2008 10:41 AM More info
- Marked As Answer by Hua Chen Tuesday, December 30, 2008 9:52 AM
- Unmarked As Answer by Ted Nugent Monday, January 19, 2009 4:24 PM
-
Thursday, December 25, 2008 10:23 AMRunning tf.exe with a command file is more efficient than running multiple tf.exe commands. From the link above: "A command file enables you to perform multiple commands more quickly than a series of individual commands because a command file reuses a single connection to the application-tier server and creates only one instance of tf.".
So if you can generate a command file for your batch of updates you might be good off.
Another option for creating scripts to automate common tasks may be to use the power shell commandlet that's available in the latest power tools. See http://www.microsoft.com/downloads/details.aspx?FamilyID=fbd14eea-781f-45a1-8c46-9f6ba2f68bf0&DisplayLang=en for info on that.- Marked As Answer by Hua Chen Thursday, December 25, 2008 10:42 AM
- Unmarked As Answer by Ted Nugent Thursday, December 25, 2008 4:57 PM
- Marked As Answer by Hua Chen Tuesday, December 30, 2008 9:52 AM
- Unmarked As Answer by Ted Nugent Monday, January 19, 2009 2:50 AM
-
Thursday, December 25, 2008 4:59 PMSo what you're saying is:
tf checkin /noprompt file1 file2 file3.....file1000
That is one long command line. And this will work?
Thanks,
Ted -
Thursday, December 25, 2008 5:44 PMYes, that will work. If you want to do a series of actions a command file is better since it will not autenticate between each command. The command file not have the tf.exe command first, just the actions and parameters.
- Marked As Answer by Hua Chen Tuesday, December 30, 2008 9:52 AM
- Unmarked As Answer by Ted Nugent Monday, January 19, 2009 2:49 AM
-
Monday, January 19, 2009 2:50 AMIt looks to us like there there is a line length limit (~8000 characters). Does this make sense? So we need a better solution than doing this on the command line. Is there a way to do this with a large number of files?
Thanks,
Ted -
Monday, January 19, 2009 11:41 AMI wasn't aware of the line length limitation. Maybe you can get around that using wildcards in the script or by issuing multiple commands in the script?
-
Monday, January 19, 2009 4:23 PMWe're trying to find out if there's a tf command line length limit and what that limit is (if there is one). Could the command line length be an OS (Vista) limitation?
Thanks,
Ted -
Monday, January 19, 2009 6:24 PMHello,
I'm not aware of any limitations on command line length when running simple tf.exe. I just run "tf add" with 2000 file which resulted in roughly 20000 char length and it was fine. If you can provide an exact repro scenario I would definitely take a look at it.
Here are few tricks how to perform tf.exe operations in efficient manner:
- if it's possible, run recursive operation. If you can do "tf add /r" on the root, it will be hundreds time faster then specifying each file separately
- Specify all files in single command line call (what you are trying to do)
- Use tf @script_file
In yoiur case you may still consider using script file, because it has rarely used new line escape character.
Script file:
add file1 \
file2 \
file 3
status
There are 2 known bugs that are fixed in dev10:
- there is limit of about 3200 characters for whole line (after combining escaped lines); above this limit characters are ignored
- if last line of the script end with escape character; the last command is not executed at all
Hope this helps
Michal Malecki- Marked As Answer by Ted Nugent Monday, January 19, 2009 6:28 PM
- Unmarked As Answer by Ted Nugent Friday, April 24, 2009 5:34 AM
-
Monday, January 19, 2009 6:33 PMHi Michal,
That's the info we were looking for.
We put the tf command line ~8000 characters in a batch file and just run it. It seems like tf gets most of the line correct and stops somewhere towards the end. When we broke it up into two batch files, it ran fine which makes us think that there is some sort of limitation there.
We're checking out our text editor to make sure it doesn't have any sort of column limit....
Did you run your test from a batch file and on Vista?
Thanks,
Ted -
Wednesday, January 21, 2009 5:08 PMPowershell:
cat list_of_files.txt | tfpend -edit
-
Friday, April 24, 2009 5:36 AM
Hello,
So it turns out that the line length problem was simple:
Filenames with spaces MUST BE QUOTED on the command line....
Obvious - I know - but hopefully this will help someone with the same problem.....
Thanks for the help,
Ted- Marked As Answer by Ted Nugent Friday, April 24, 2009 5:37 AM

