I am programmatically generating a command to be submitted to cmd.exe using Runtime.getRuntime.exec() from java.
The command is tortoiseproc ignore command of the form
tortoiseproc /command:ignore /path:file1*file2*file3*...................filen
As you can see, the path parameter takes a number of files and problem occurs when this string exceeds a certain length approx. 8197 characters as documented in microsoft KB for cmd.exe.
The workaround there says that modify the program so that it accepts the parameters from a file rather than from the commandline string. Does anybody know how to pass parameters to tortoiseproc.exe via file?
you can pass a file in utf16 format, with each file listed on a separate line.
Pass the path to that file with /pathfile:"path/to/file.txt"
Nope, that's not possible. However, in this specific case, it doesn't matter: you can split the file list into multiple smaller ones, and run the tortoiseproc multiple times. Example:
tortoiseproc /command:ignore /path:file1*file2*file3*file4
tortoiseproc /command:ignore /path:file5*file6*file7*file8
and so on, up to file n.
I had same problem and this is my solution for that:
using (var s = File.Create("D:\\p3.tmp"))
{
using (var sw = new StreamWriter(s, new UnicodeEncoding(false, false)))
{
sw.Write(@"D:\SourceCode\Utils\ProductProvider.cs" + '\n');
sw.Write(@"D:\SourceCode\Utils\BillingProvider.cs"+ '\n');
}
}
after file is created I use
TortoiseProc.exe /command:commit /pathfile:"D:\p3.tmp" /logmsg:"test log message" /deletepathfile