I am using the command:

7z.exe x -y -o<dir> <archive dir> * -aoa -r

to extract all archives that are located in the archive directory.

I am running into a problem where exe files that are packaged end up getting extracted as well.

Is there a way to extract all files within a directory but exclude *.exe files?

I tried the -x flag (-x!.exe and -xr!.exe), but they exclude extracting *.exe from within the rar and zip archives.

Thanks for the help.

1 Answer 1


You should specify what files to extract from inside the <archive> folder. If you want to only extract files from .zip files, you should specify <archive>\*.zip.

7z.exe x -y -o<dir> <archive dir>\*.zip * -aoa -r
  • Or if you change to dir first, you can omit that and run just 7z.exe x -y <archive dir>\*.zip * -aoa -r. Dec 31, 2018 at 3:54

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.