Extract file with 7zip not working

I am trying to extract a file using 7zip by starting a process and passing the parameters in the arguments I cant get it to unzip. does anyone know how to do this?
string tempfile = localpath + "\\MyFile.7z";
                    fts.DownloadMasterStickFTPFile(tempfile, "MyFile.7z");    //download the file to temp

                    FileInfo tempfi = new FileInfo(tempfile);

                        string currentFileName = tempfi.FullName;
                        var processStartInfo = new ProcessStartInfo();
                        processStartInfo.FileName = @"C:\Program Files\7-Zip\7z.exe";
                        processStartInfo.Arguments = "x " + localpath + "\\MyFile.7z ";
                        processStartInfo.UseShellExecute = false;

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

r3nderAuthor Commented:
shellI am getting this now - how do I pass the argument to just do it
Robert SchuttSoftware EngineerCommented:
I only have an old version I think but the help file says:
-y (assume Yes on all queries) switch
Disables most of the normal user queries during 7-Zip execution. You can use this switch to suppress overwrite queries in the e (Extract) and x (Extract with full paths) commands.


7z x src.zip -y

extracts all files from src.zip archive. All overwrite queries will be suppressed and files on disk with same filenames as in archive will be overwritten.

Commands that can be used with this switch
e (Extract), x (Extract with full paths)
So can you try changing this line, add "-y" option at the end:
processStartInfo.Arguments = "x " + localpath + "\\MyFile.7z -y ";

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
käµfm³d 👽Commented:
** No Points **

Robert Schutt is correct:  This option exists even in 9.20:

r3nderAuthor Commented:
Thanks all
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.