I need to unzip a compressed file with the command line version of 7zip. This one liner should to the trick:
Process.Start("cmd", @"C:\Users\cw\Downloads\7za920\7za e C:\UPDATED.zip -oc:\");
I'm specifying the path to the 7zip command line executable, and telling it which file to unzip. If I copy and paste those arguments into my command line window, it will work. In C#, it will bring up a command line window, and nothing will happen. What gives?
尝试:
Process.Start("cmd", @"/c C:\Users\cw\Downloads\7za920\7za e C:\UPDATED.zip -oc:\");
It's because you're running cmd.exe, and not 7za directly. You can do either of the two:
Process.Start(@"C:\users\...\7za", "e c:\updated.zip -oc:\");
or
Process.Start("cmd", @"/c c:\users\...\7za e c:\updated.zip -oc:\");
The /c flag tells cmd to run the arguments after starting.
尝试
Process.Start(@"C:\Users\cw\Downloads\7za920\7za.exe", @"e C:\UPDATED.zip -oc:\");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.