我想通过我的控制台应用程序压缩文件夹,这就是为什么我使用类似的东西
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 参数验证错误之类的错误。我在哪里做错了?
Update
我在 -eZ 上拼写错误,实际上它可能是 -ex 等……但另一个问题是 winzip 打开了自己的窗口。我为它写了-min 但是它打开了。