A
A
Alex2019-05-16 08:12:57
Data archiving
Alex, 2019-05-16 08:12:57

How to make "infinite" number of options when archiving 7zip via cmd?

The essence of the task:
You need to write a batch file / cmd for archiving files. The first parameter is the path where to archive, all subsequent parameters (there may be more than 10) are what needs to be archived.
I managed to do it with only 2 parameters

@echo off
set dd=%DATE:~0,2%
set mm=%DATE:~3,2%
set yyyy=%DATE:~6,4%
set curdate=%dd%-%mm%-%yyyy%
set destination=%1
set source=%2
"C:\Program Files\7-Zip\7z.exe" a -tzip -ssw -mx1 -r0 %destination%\backup_%curdate%.zip %source%

I tried to do it through shift and for but it didn’t work out)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question