Using Scheduled tasks in Windows to implement automatic backup files _win servers

Source: Internet
Author: User
Tags current time time and date

We use the Windows system's scheduled tasks to implement the database backup, 1, is the folder copy to a fixed folder, 2. is a folder copy to the day of the automatically generated folder:

1: Our company to do a "daily statistics offline film" application, I first put this function into a WinForm program to generate an EXE file

2: "Start-> program-> attachment-> System Tool" find it, open the Scheduled Tasks window

3: Double-click the Add Scheduled Tasks item to start the Scheduled Task wizard

  

4: Select the application to execute, here we choose to have the "statistics every day offline movie" function exe file

5: Enter the task name, you can use the default name or take a name you like, select the way the task is executed, we choose the "daily" item

  

6: Set the task start time and date, the default is the current time and date, we will start time to 9:00, that is, we work time

  

7: A new task is added to the Scheduled Tasks window by clicking the Finish button

  

  

Let's take a look at how the backup was first recorded. To copy the following lines of code into a. bat file (except in parentheses), execute the file on a daily schedule of execution.

Copy Code code as follows:

C:\WINDOWS\system32\xcopy Z:\b-b-car.com d:\b-b-car.combak/y/e

(Y:\ replacement is not required to confirm,

Copy Code code 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

(d:\ directory f:\ file y:\ replace without confirmation, e:\ copy all files)

The automatic backup database can be used with the following commands, note that the database must have a password, because there is no password to be confirmed once, can not achieve the effect of automatic backup

Copy Code code 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"

Related Article

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.