

The deletion of all *.rar files after unpacking them is done also without a for loop as command del supports also deletion of all *.rar files in all subfolders of a folder.įor deletion of all subfolders in source folder being empty after deleting all RAR files, but keeping the source folder, a for loop is finally necessary as added to code above. output only error messages, but no progress information which is faster. Usage of -ad depends on contents of the archive files. Option -ad meaning append archive name to destination path could be removed from RAR command line if all archives contain a unique folder name, or all archives should be unpacked into same directory with overwriting already existing files from a previous archive unpacked before. Rar.exe supports wildcards on decompressing RAR archive files and switch -r used on command x results in processing all RAR archive files also in all subfolders as the manual explains.

Unpacking all *.rar files in all subfolders of a source folder can be done directly with Rar.exe as it can be seen because no for loop is used in batch code. "%ProgramFiles%\WinRAR\Rar.exe" x -ad -cfg-idq -r -y "%SourceFolder%\*.rar" "%TargetFolder%"įor /D %%D in ("%SourceFolder%\*") do rd "%%D" 2>nulĬonsole version Rar.exe is more powerful than most users never reading the manual Rar.txt stored in program files folder of WinRAR are aware of. If not exist "%TargetFolder%" md "%TargetFolder%" This little batch code hopefully does what you want.
