[英]how to pass parameters to tortoiseproc.exe via file?
我正在以編程方式生成一個命令,該命令將從Java使用Runtime.getRuntime.exec()提交給cmd.exe。
該命令是tortoiseproc的格式忽略命令
tortoiseproc /command:ignore /path:file1*file2*file3*...................filen
如您所見,path參數需要多個文件,並且當此字符串超過一定長度時會出現問題。 如cmd.exe的Microsoft KB中記錄的8197個字符。
那里的解決方法是修改程序,以便它接受來自文件而不是命令行字符串的參數。 有人知道如何通過文件將參數傳遞給tortoiseproc.exe嗎?
您可以傳遞utf16格式的文件,每個文件都在單獨的行中列出。
使用/ /pathfile:"path/to/file.txt"
將路徑傳遞到該文件: /pathfile:"path/to/file.txt"
path / to / /pathfile:"path/to/file.txt"
我有同樣的問題,這是我的解決方案:
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');
}
}
創建文件后,我使用
TortoiseProc.exe /command:commit /pathfile:"D:\p3.tmp" /logmsg:"test log message" /deletepathfile
不,那是不可能的。 但是, 在這種特定情況下 ,沒關系:您可以將文件列表拆分為多個較小的文件,然后多次運行tortoiseproc。 例:
tortoiseproc /command:ignore /path:file1*file2*file3*file4
tortoiseproc /command:ignore /path:file5*file6*file7*file8
依此類推,直到文件n 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.