Question

I am trying to create batch file and couldn't find solution anywhere on the web. I would like to archive (Winrar) folder&subfolders (eg.Folder A in C:\Temp\A). Folder A has a bunch of subfolders & files.

I am using this command :

"C:\Program Files\WinRAR\WinRAR.exe" a -esh -m5 -mt2 -r -s -t "ZZZZ.rar" 

Problem is that I would like archive to be named same as the name of the main folder (in this case folder "A" - A.rar), and archive to be send to folder C:\Temp (up one level).

Was it helpful?

Solution

I don't have WinRAR, so I can't check the syntax for the rar command, but you could create a batchfile (backup.bat) like:

cd %1
"C:\Program Files\WinRAR\WinRAR.exe" a -esh -m5 -mt2 -r -s -t "..\%1.rar"
cd ..

And invoke it with

backup A

from the temp folder. That might be a start...

OTHER TIPS

@echo off ( CD\ C: cd "Temp\A" ) "%programfiles%\winrar\rar" a -r "C:\ZZZZ.rar"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top