![]() As a way to ensure the tasks are updated, you could include the appropriate SchTasks commands in a domain login script which will update user machines when they log in. The ability to do this is a quick way to roll out new tasks or change existing schedules to many machines at once. SchTasks /Create /SC DAILY /TN “Backup Data” /TR “C:Backup.bat” /ST 07:00 SchTasks /Create /SC WEEKLY /D MON /TN “Generate TPS Reports” /TR “C:GenerateTPS.bat” /ST 09:00 SchTasks /Create /SC MONTHLY /D 1 /TN “Sync Database” /TR “C:SyncDB.bat” /ST 05:00 Like any other command line tool, you can include multiple instructions in a batch file to accomplish bulk creation (or deletion). Note: this will raise a warning which you will need to confirm. SchTasks /Create /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN “My Task” /TR “C:RunMe.bat” /ST 14:00 SchTasks /Create /SC MONTHLY /D 1 /TN “My Task” /TR “C:RunMe.bat” /ST 14:00Ĭreate ‘My Task’ to run C:RunMe.bat every weekday at 2 PM: For fixed-size messages you can use snippets from the above to: (1) calculate length of parameter text, (2) calculate ( (total-length - parameter-length) / 2) -1 to be the number of blanks, (3) make string with this number of blanks, (4) construct the message of ' blanks text blanks ', (5) create asterisks line as above. SchTasks /Create /SC DAILY /TN “My Task” /TR “C:RunMe.bat” /ST 09:00Ĭreate ‘My Task’ to run C:RunMe.bat on the first of every month: This example shows how to create a batch file (an external program) that works with the EXTERNALCOMMAND to open and display a file. ![]() For example, you might want to name it helloworld.bat. Give it any name you like, but replace the default. Create ‘My Task’ to run C:RunMe.bat at 9 AM everyday: Type the following lines into it: ECHO OFF ECHO Hello World PAUSE Next, save the file by clicking File > Save.
0 Comments
Leave a Reply. |