Skip to main content

Posts

Showing posts with the label batch

Compression in BAT by using 7z

To compress direcotry or files in batch program all You need to do is  to install 7z opensource and create simple 'task.bat' file with only few line of code: @echo Start processing "C:\Program Files\7-Zip"\7zg.exe a C:\Backup\important_data_%date:~0,4%%date:~5,2%%date:~8,2%.7z C:\inetpub\wwwroot\BestWebsite -t7z -mx9 -m0=LZMA -pMYPassword @echo End PAUSE What we do here is: 1) Run 7zg.exe program 2) Create target file important_data_(current data).7z in C:\Backup\ directory 3) Indicate file or folder to compress in this ex we compress 'BestWebsite' directory 4) Set compression parameter in this example we have-t7z -mx9 -m0=LZMA 5) Optionally set a password to compressed document Thank you