How to Automatically compress RAR Files

Those of us who constantly backup our files or create files to upload to the web we sometimes run into issues with having so many files in our computer that we are looking to compress. One of the most popular compression formats today is .RAR, as many use it because it is really reliable.

Imagine if there was a way to automatically compress all the files you want using RAR compression without lifting a finger.

The following guide will help you:

This procedure requires you to write a simple batch file, and create a scheduled task.

Open notepad and type the following:


cd C:directory_with_files_you_want_to_compress

SET PATH=C:;C:Program Files (x86)WinRAR;C:Windowssystem32;C:Windows;C:Win dowsSystem32Wbem;%PATH%

FOR /f "delims=" %%d IN ('DIR /B') DO WinRAR a -m0 -ep -df "C:where_you_want_to_save_new_rar_files%%~nxd.ra r" "%%~fd"


In Notepad make sure you save this as AutoRAR.bat and place it in the desktop.

Save this as AutoRaR.bat (or whatever you want) and save it where you want

The batch file will then check “C:directory_you_want_to_compress” is the directory where the files should exist that you are looking to compress.

SET PATH will find rar.exe to run in command prompt

DO WinRar executes winrar
-m0 is the compression level, where compression level (0-store…3-default …5-maximal) you can set which ever you want

-ep excludes the path from the created rar name (You can remove if you want to include path)

-df deletes the original files in the main directory you set first ¨C:directory_you_want_to_compress¨
You can remove this if you want to maintain the files and remove manually later