13

I am trying to write a batch script to extract files out of an existing ZIP file, into another folder on my desktop and to have the system not prompt me as to whether I want to overwrite the existing files or not. The script works with just -o, but once I add -aoa, I get an error:

"C:\Program Files\7-zip\7z.exe" e file1.zip "-aoaC:\Documents and Settings\All Users\Desktop\all_backup_files"
15

The 7-Zip command line options you will need are x, -o and -y:

"C:\Program Files\7-zip\7z.exe" x file1.zip -o "C:\Documents and Settings\All Users\Desktop\all_backup_files" -y

If you type 7z --help you will get a list of valid parameters.

  • Thanks very much for this Sean. For me it was where to put the switch. I fixed the batch programs and they all work great now. – Larry Oct 3 '12 at 19:24
1
"C:\Program Files\7-zip\7z.exe" e file1.zip " -aoa -o "C:\Documents and Settings\All Users\Desktop\all_backup_files"

this will solve the problem refer https://sevenzip.osdn.jp/chm/cmdline/switches/overwrite.htm

  • 1
    Welcome to Super User. On this Q&A site we value answers that remain useful if/when linked material becomes inaccessable. Please edit your answer so that it includes the essential elements from your linked source. – Twisty Impersonator Apr 9 '18 at 13:43
  • On top of which, this doesn't seem to work. Not sure if it's a version issue, but pasting this exact command into my CLI results in the error "Too long switch". Despite when I check --help, the -aoa switch is listed. The only command that worked for me is SeanC's above. – Carl Steinhilber Jan 17 at 20:34
  • @CarlSteinhilber - -aoa works - I fixed the space after the -o parameter which throws this oddball CLI exception – SliverNinja - MSFT Mar 28 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.