Using Batch Processing to Implement WinRAR for Multiple Compression and Decompression

  
Through some simple batch commands, we can let WinRAR achieve multiple compression and decompression. The following is a detailed introduction to this technique. First of all, we need to download and install WinRAR compression software. 1. First create a folder, any name, here Xiaobian named it work, and then create a folder called temp (must be called temp) in the work. Ok, copy the following batch code to the bat file and put it in the work folder; 2. Put the rar that needs multiple compression or need to solve multiple compressions into the work folder, click the corresponding bat file. The batch code is as follows: Multiple compression: 01 ::Multiple compression 02 @echo off03 setlocal ENABLEDELAYEDEXPANSION04 color 0a05 set /p num=Enter the number of times to be compressed: 06 echo Begin...07 set n=008 set m=109 set path=" ;C:\\Program Files\\WinRAR\\WinRAR.exe"10 if exist *.rar (11 ren *.rar 0.rar>nul 2>nul12 for /l %%i in (1,1,%num%) do (13 "C:\\Program Files\\WinRAR\\WinRAR.exe" a -ibck -e !m!.rar !n!.rar14 del !n!.rar15 set /a n+=116 set /a m+=117 ) 18)19 echo OK!20 pause multiple decompression: 01 ::Multiple decompression 02 @echo off03 rem File decompressed temporary folder 04 set path="%~dp0temp\\"05 color 0a06 echo Begin...07 : Go08 if exist *.rar (09 "C:\\Program Files\\WinRAR\\WinRAR.exe" x -ibck -o+ *.rar %path%10 del *.rar11 cd temp12 move *.rar ..>nul 2> ;nul13 cd ..14 ) else (15 echo OK!16 pause17 exit18 )19 goto go 
Copyright © Windows knowledge All Rights Reserved