I agree with your commenters that using DotNetZip is nicer from within an app.
Even if you don't take that advice, there are easy things you can do to make your life better if you continue to use wzzip.exe. First: collect and log the standard output and standard error. Your code redirects the standard output, but does not log it, or display it. It ignores standard error messages. Second: check the exit code of the process.
In my experience, when the command-line winzip program fails, it emits something to its stdout, which describes the failure. "File not found" or "inconsistent options" or something like that.
Also: wzzip.exe is very verbose in its output. It emits progress messages as it runs, and then it emits backspaces to "erase" the most recent message, and then another progress message, and so on. 80% or more of wzzip.exe output can be backspaces. With all this output, wzzip.exe can fill up the output buffers. If you don't read them in your app, you may run into a deadlock situation.
So you should read stdout and stderr for 2 reasons: to check results, and also to avoid deadlocks resulting from full output buffers.
The test suite for DotNetZip includes code that runs wzzip.exe successfully, to make sure that winzip is compatible with dotnetzip, and vice versa. This is basically what it looks like (taken from TestUtilities.cs):
public void Exec(string program, string args)
{
System.Diagnostics.Process p = new System.Diagnostics.Process
{
StartInfo =
{
FileName = program, // wzzip.exe in your case
CreateNoWindow = true,
Arguments = args, // whatever you like
WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
UseShellExecute = false,
}
};
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
// Must read at least one of the stderr or stdout asynchronously,
// to avoid deadlock. I choose to read stderr asynchronously.
var sb = new StringBuilder();
p.ErrorDataReceived += new DataReceivedEventHandler((o, e) => {
if (!String.IsNullOrEmpty(e.Data))
sb.Append(e.Data);
});
p.Start();
p.BeginErrorReadLine();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
// Important:
// Display or log the output here. stdout output is available in variable "output";
// stderr is available in sb.ToString()
if (p.ExitCode != 0)
throw new Exception(String.Format("Non-zero return code {0}",
p.ExitCode));
}
This code will work with any exe that emits output.
There is also a method, not shown here, that strips the backspaces from the wzzip.exe output. It makes it easier to understand the output when displaying to a human as a string - like in a MessageBox or whatever. Check the TestUtilities code for that method.
ps: just re-reading your Q, I see you mention winzip32.exe. i don't know what winzip32.exe is. The command-line version of the tool that winzip publishes is wzzip.exe . My remarks about output and backspaces apply to that tool.