參數我想通過這就是爲什麼我用類似呼叫Winzip32.exe用C#
public void DoWinzip(string zipName, string password, string folderName)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "C:\\Program Files\\WinZip\\winzip32.exe";
startInfo.Arguments = string.Format("-min -eZ {0} {1}", zipName, folderName);
try
{
// Start the process with the info we specified.
// Call WaitForExit and then the using statement will close.
using (Process exeProcess = Process.Start(startInfo))
{
exeProcess.WaitForExit();
}
}
catch(Exception ex)
{
// Log error.
}
}
但是,這會給我喜歡WinZip的參數驗證錯誤,錯誤我的控制檯應用程序的zip文件夾中。我錯在哪裏?
Update
我拼寫錯了-eZ其實可能-ex等......但另一個問題是winzip打開自己的窗口。我爲它寫了 - 但是它打開了。
爲什麼不用SharpZipLib(http://www.icsharpcode.net/opensource/sharpziplib/)?然後你完全控制了壓縮過程。 – 2012-02-25 13:41:18
我這樣做沒問題,但它提供了比WinZip更大的MB大小的zip文件 – 2012-02-25 13:44:28