Using WinRAR command-line tools
When you install WinRar, two command-line tools are also installed, rar.exe and unrar.exe. They will be located in C:\Program Files\WinRAR by default.
Here's an example of how to extract the contents of a single rar file:
1. open a command prompt
(Windows 2000/xp, choose start->programs->accessories->Command Prompt)
2. add the winrar tools to the path:
c:\> set path="C:\Program Files\WinRAR\";%path%
3. switch to the directory where you want your files to extract to:
c:\> cd /d z:\some_folder
4. use unrar to extract the file:
z:\some_folder> unrar e c:\some_rar_file.rar
You can of course wrap all of this into a batch file that loops through all of the .rar files in a folder. Here's a quicky sample (doesn't handle spaces in .rar file names):
Code:
@REM ------- BEGIN demo.cmd ----------------
@setlocal
@echo off
set path="C:\Program Files\WinRAR\";%path%
for /F %%i in ('dir /s/b *.rar') do call :do_extract "%%i"
goto :eof
:do_extract
echo %1
mkdir %~1.extracted
pushd %~1.extracted
unrar e %1
popd
REM ------- END demo.cmd ------------------
Source: respower.com
Bookmarks