Answer the question
In order to leave comments, you need to log in
A script for searching and archiving files according to a template, how to implement it on cmd?
Good afternoon.
It is required to make a script that will search for files with the required extension and then archive them.
The search is performed by the command: WHERE /R C:\ *.*
At the output we get a list of files and we need to pass them to the input of the archiving command, everything is clear with one file, but what to do when we have several files and how to enter their names in the name of the variable passed to the archiver.
Thank you very much in advance. I would be grateful for any advice on how to implement this using windows cmd
Answer the question
In order to leave comments, you need to log in
sevenzip.sourceforge.jp/chm/cmdline/switches/recur...
If you need to create an archive for each file, then create the following cmd file:
chcp 1251
for /F "tokens=*" %%i in ('where /R "C:\" *.*') do "C:\Program Files\7-Zip\7z.exe" a "%%i.7z" "%%i"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question