How to extract both ZIP and RAR archives using 7-Zip command?

1.2k views Asked by At

Using 7-Zip command line it's easy to extract either RAR or ZIP archives. The following code is for extracting ZIP archives:

7z x *.zip -r

How to recode it so that it will work for both ZIP and RAR archives (or other additional archives that I can add based on my preference)?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

In a cmd window

For %A in (zip rar) do 7z.exe x -r *.%A

In a batch file

For %%A in (zip rar) do 7z.exe x -r *.%%A