Run batch file to zip file using WinRAR

Hi, I have a bat file that runs the following batch script. It works in that it will delete the ZipFile.rar if it exists and then creates a new rar file.

The problem is that the script is adding the folder and .bak file to the ZipFile.rar, how can I specify to ignore the folders and just zip up the .bak file.

I need to run the batch command from another folder (not in C:\Temp\Backup)

Thank you

if exist "C:\Temp\Backup\ZipFile.rar" del "C:\Temp\Backup\ZipFile.rar"
"C:\Program Files\WinRAR\rar.exe" a "C:\Temp\Backup\ZipFile.rar" "C:\Temp\Backup\SQLDb.bak"  -ms

Open in new window

crompnkData Management SpecialistAsked:
Who is Participating?
 
oBdACommented:
The "-ep" switch should help. The "-ms" is not really required, since you're only zipping one file of the same type.
if exist "C:\Temp\Backup\ZipFile.rar" del "C:\Temp\Backup\ZipFile.rar"
"C:\Program Files\WinRAR\rar.exe" a -ep "C:\Temp\Backup\ZipFile.rar" "C:\Temp\Backup\SQLDb.bak" -ms

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.