0

コンソールアプリケーションを介してzipフォルダーが必要なため、次のようなものを使用しました

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 などの可能性があります。しかし、もう 1 つの問題は、winzip が独自のウィンドウを開くことです。私はそれのために書いています-分しかしそれは開きました。

4

4 に答える 4

1

おそらく、パスを二重引用符で囲まずに空白 (inzipNamefolderName引数) で渡しています。

于 2012-02-25T13:43:43.527 に答える
0

ProcessStartInfo.WindowStyleプロパティを使用して、ウィンドウを開くことを回避できます。

これを試して:

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "C:\\Program Files\\WinZip\\winzip32.exe";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
于 2012-02-25T15:47:45.497 に答える
0

オプションとは何-eZですか? それはあなたの問題だと思います

圧縮方法を決めるには以下の選択肢しかないと思いました。

-ex=エクストラ

-en= 通常

-ef=速い

-es= 超高速

-e0= 圧縮なし

于 2012-02-25T13:48:02.420 に答える
0

http://www.rondebruin.nl/parameters.htm -> それを見ると、コードは次のようになります。

startInfo.Arguments = string.Format("-e {0} {1}", zipName, folderName);

于 2012-02-25T13:42:35.740 に答える