Save as unpack.bat
@echo off REM Assumes (x64 7zip on x64 OS or x86 7zip on x86 OS ) and (default 7zip installation path) REM Unpack all RAR files in and below directory (X) with 7zip into specified subfolder REM Example: C:\unpack.bat "D:\some\directory\or another\" "extract" REM store variables set target=%1 set destination=%2 REM remove quotation marks set target=%target:"=% set destination=%destination:"=% REM switch to target drive for command context %target~0,2% REM switch to target directory cd "%target%" REM check target directory and subdirectories for RAR files to extract. @echo on "C:\Program Files\7-Zip\7z.exe" x *.rar -o"%destination%" -y for /d /r "%target%" %%X in (*) do (cd "%%X" && "C:\Program Files\7-Zip\7z.exe" x *.rar -o"%destination%" -y)