3

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?

1
  • the process you are starting is cmd, which is a command line. You don't need to do this. Just call the 7zip executable. Commented Feb 24, 2012 at 15:41

3 Answers 3

4

Try:

Process.Start("cmd", @"/c C:\Users\cw\Downloads\7za920\7za e C:\UPDATED.zip -oc:\"); 
Sign up to request clarification or add additional context in comments.

Comments

4

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.

Comments

2

Try

Process.Start(@"C:\Users\cw\Downloads\7za920\7za.exe", @"e C:\UPDATED.zip -oc:\"); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.