Windows Server 2008 offers many more capabilities in Task Scheduler than the previous versions. Although these new capabilities are not exposed through the AT command, you can use the GUI console to access them.
One of the useful capabilities is that you can add arguments when you choose starting a program. This option provides the possibility of reusing a generic program in multiple schedulers instead of specify the arguments in multiple programs.
For example, if we need to create txt files with different names every hour, we can create 24 scheduler passing different names to one batch file (rather than 24 batch files). Below is the detailed step:
1. Prepare the batch file: copy the following script into an empty file and rename it as CreateFile.bat:
@echo off
@date /T > “C:\%1.txt”
2. Log in Windows server as administrator, click Start -> Administrative Tools -> Task Scheduler;
3. Click Task Scheduler Library in left panel, it will list all currently scheduled tasks;
4. Click Create Task on right panel (or right click on #3):
4.1 In Generate tab: fill in CreateFile1 as Name;
4.2 In Triggers tab: click New, in Settings check Daily, for Start choose 12:00AM;
4.3 In Actions tab: click New, for Program/script choose the CreateFile.bat file path; in Add arguments (optional), use the same Name as in #4.1 (which will pass to the batch file as parameter value for %1);
5. Repeat #4 for every hour.
Note: Batch file supports 9 input parameters, if you use more than one in batch file, use semicolon to separate them in #4.3.
Windows Server 2008 offers many more capabilities in Task Scheduler than the previous versions. Although these new capabilities are not exposed through the AT command, you can use the GUI console to access them.
One of the useful capabilities is that you can add arguments when you choose starting a program. This option provides the possibility of reusing a generic program in multiple schedulers instead of specify the arguments in multiple programs.
For example, if we need to create txt files with different names every hour, we can create 24 scheduler passing different names to one batch file (rather than 24 batch files). Below is the detailed step:
1. Prepare the batch file: copy the following script into an empty file and rename it as CreateFile.bat:
@echo off
@date /T > “C:\%1.txt”
2. Log in Windows server as administrator, click Start -> Administrative Tools -> Task Scheduler;
3. Click Task Scheduler Library in left panel, it will list all currently scheduled tasks;
4. Click Create Task on right panel (or right click on #3):
4.1 In Generate tab: fill in CreateFile1 as Name;
4.2 In Triggers tab: click New, in Settings check Daily, for Start choose 12:00AM;
4.3 In Actions tab: click New, for Program/script choose the CreateFile.bat file path; in Add arguments (optional), use the same Name as in #4.1 (which will pass to the batch file as parameter value for %1);
5. Repeat #4 for every hour.
Note: Batch file supports 9 input parameters, if you use more than one in batch file, use semicolon to separate them in #4.3.