开发者

how to pass parameters to tortoiseproc.exe via file?

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 o开发者_如何学编程f 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜