Answer the question
In order to leave comments, you need to log in
How to make a bat file for backup?
Hello.
Can you please tell me how to create a bat file to run it in the windows task scheduler.
Given: folder with files.
Required: at intervals set in the scheduler, archive the given folder into a zip file in the folder with archives. Set the current time to seconds as the name of the archive.
Thank you.
Answer the question
In order to leave comments, you need to log in
Something like this "c:\program files (x86)\7-zip\7z.exe" a %date%.7z -mx9 -m0=LZMA2 -i!<folder1>\*.* -i!<folder2> \*.*
Copy %date%.7z
Zip can be done too.
Well, start the scheduler there, create a task, add a bat-nick and specify the frequency...
This is done in almost one command, approximately as dmfun
answered.
Select a suitable command line archiver, study its parameters, train on "cats", then insert the resulting command into a batch file, and launch the batch file into a scheduler.
Difficulties may arise only with the formation of the file name. You can use the variables %DATE% and %TIME%.
The content of the variables changes automatically with each call.
You can see the current values like this:
echo %DATE [%TIME%]
From %TIME%, you will most likely have to manually pull out the numerical values of hours / minutes / seconds, this can be done either by extracting a substring (see set /?), or by processing the variable in for (see for /?).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question