How do I get the 7-Zip exit code from the console output?
I am writing a 开发者_如何学编程c# application that uses 7-zip to compress a directory. 7-Zip returns an exit status after zipping up a file. In the console window all I see is
Everything is Ok
which equates to an exit code of 0. But does anybody know if there is a way I can get that number?
I assume you're starting 7-zip as a separate process using the System.Diagnostics.Process class.
From MSDN:
Process.ExitCode Property
Gets the value that the associated process specified when it terminated.
You might be interested in SevenZipSharp which provides a managed wrapper for the 7z.dll.
精彩评论