Showing posts with label RAR. Show all posts
Showing posts with label RAR. Show all posts

Friday, April 22, 2011

Rar and UnRar in DOS.cmd

To Rar all directories in the current folder and make a rar file using the folder name:
@echo off
@setlocal
REM
REM Unrar all .rar files on the current directory and use the full path
REM

set path="%ProgramFiles(x86)%\WinRAR\";%path%
for /F %%i in ('dir /b *.rar') do call :do_extract "%%i"

:eof
pause
exit 1

:do_extract
echo %1
REM x : Extract files with full path
REM -y : Assume Yes on all queries
unrar x -y %1



To Unrar all files in the current location using FullPath:

@echo off
@setlocal
REM
REM Unrar all .rar files on the current directory and use the full path
REM

set path="%ProgramFiles(x86)%\WinRAR\";%path%
for /F %%i in ('dir /b *.rar') do call :do_extract "%%i"

:eof
pause
exit 1

:do_extract
echo %1
REM x : Extract files with full path
REM -y : Assume Yes on all queries
unrar x -y %1