@echo off setlocal if "%~2" == "" ( echo Usage: dirs2rars {source folder} {rars folder} goto :eof ) set rarpath="c:\program files\winrar\winrar.exe" pushd %1 if errorlevel 1 ( echo Source folder is not found. goto :eof ) if not exist "%~2\nul" ( echo Destination folder is not found. goto :eof ) for /d %%A in (*) do ( pushd "%%A" start /b /wait "" %rarpath% a -r -s "%~2\%%~nxA.rar" popd )