Automatic file backup using scheduled tasks in Windows

Source: Internet
Author: User

We will use the scheduled tasks in windows to back up the database. 1. copy the folder to a fixed folder, and 2. copy the folder to the automatically generated folder on the current day:

1: Our company is going to create an application for "counting offline movies every day". I will first make this function into a WinForm program to generate an exe file.

2: Choose Start> program> attachment> System Tools to open the scheduled task window.

3: Double-click "add scheduled task" to start the "scheduled task wizard"

  

4: select the application to be executed. Here we select the exe file with the function of "counting offline movies every day ".

5: Enter the task name. You can use the default name or a name you like. Select the task execution method and select the "Daily" item.

  

6: Set the start time and date of the task. The default time is the current time and date. We will change the start time to, that is, the start time.

  

7. Click "finish". A new task is added to the "scheduled task" window.

  

  

Let's take a look at the backup file! Copy the following lines of code into a. bat file (except the brackets) and execute this file in the daily scheduled execution plan,

Copy codeThe Code is as follows: C: \ WINDOWS \ system32 \ xcopy Z: \ b-b-car.com D: \ b-b-car.combak/y/e

(Confirmation is not required for y: \ replacement,

Copy codeThe Code is as follows: set mmdd = % date :\~ 0, 4% % date :\~ 5, 2% % date :\~ 8, 2%
C: \ WINDOWS \ system32 \ xcopy Z: \ b-b-car.com D: \ b-b-car.combak % mmdd %/d/y/e

(Confirmation is not required when replacing d: \ directory f: \ file y: \, and e: \ copies all files)

The following command can be used to automatically back up a database. Note that the database must have a password, because you need to confirm the password again, and the automatic backup effect will not be reached.

Copy codeThe Code is as follows: set mmdd = % date :\~ 0, 4% % date :\~ 5, 2% % date :\~ 8, 2%
Mysqldump-h192.168.1.46-ulinhaiquan-p123456 DB_Bbcar> d: \ b-b-car.combak \ databases \ DB_Bbcar _ "% mmdd: = %" ". SQL"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.