Windows - schedule tasks in command line using schtasks
You may need the following schedules in Windows:
1) every day ftp file to another computer on 11:00pm
2) every day check new files created and redirect the result to a log file
3) every day dump mysql database
4) check any malware run in schedule
You can use schtasks in comman prompt.
1) schtasks help
schtasks /?
2) Query existing schedules
schtasks /QUERY /FO LIST /V
3) Create a new schedule
schtasks /create /tn TaskName /tr TaskRun /sc schedule [/mo modifier] [/d day]
[/m month[,month...] [/i IdleTime] [/st StartTime] [/sd StartDate] [/ed EndDate]
[/s computer [/u [domain\]user /p password]] [/ru {[Domain\]User | "System"} [/rp Password]] /?
Example
I have ftp script: ftp1.txt
open 137.82.***.***
username
password
lcd C:\sql_dumps\mysql_admin
cd dbfile
mput *.sql
y
bye
I create a executable file jiansen_ftp.bat
ftp -s:ftp1.txt
Create a schedule to run jiansen_ftp.bat every day 23:58:00
schtasks /create /tn "myftp" /tr C:\sql_dumps\jiansen_ftp.bat /sc daily /st 23:58:00
Video: Windows - schedule tasks in command line using schtasks
Комментариев нет:
Отправить комментарий