中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-23 13:28
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » How to run a batch file during a specified time period
Printable Version  2,900 / 4
Floor1 cnlogo Posted 2003-11-07 00:00
初级用户 Posts 1 Credits 107
QQ:832686
Thanks. ...
Floor2 GOTOmsdos Posted 2003-12-06 00:00
铂金会员 Posts 1,827 Credits 5,154
Using the at command
Floor3 ander9203 Posted 2004-05-15 00:00
初级用户 Posts 4 Credits 108
AT commands seem to be only available in Linux. There doesn't seem to be such a command in DOS. Is it because my DOS installation is incomplete?
Floor4 龙王 Posted 2004-05-16 00:00
银牌会员 Posts 334 Credits 1,186
I saved the repost as a text file, and the original post link has been lost, and it's the same with the time command...


For example, to execute a certain command on December 31st, you can do it like this:
1. Create a batch file named 12-31.bat. Note that the file name is the date you want to execute, because this file name will be used later. The content is everything you need to do.

2. Create a second batch file, which can be named randomly, such as run.bat (this step seems to be omitted, because if this file does not exist, the third step should be automatically generated)

3. Add these sentences in AUTOEXEC.BAT
echo.|date|find "12-31">run.bat
call run.bat

Do you understand? If not, listen to me again
The result of executing echo.|date|find "12-31">run.bat in AUTOEXEC is to execute the DATE command, which is used to display or modify the date. Since this command waits for keyboard input, the ECHO. is used earlier to give a response to this command. Then, search for the date 12-31 in the output of the DATE command and store the result in the RUN batch program. If the current day is not December 31st, then there is nothing put into the RUN batch program, so there is nothing in it. The result of these two lines is equivalent to doing nothing. If the current day is December 31st, then the string "12-31" will be stored in the RUN program. Then the next line calls this RUN batch. If the previous step stores the string 12-31 in RUN, then executing RUN at this time is actually executing 12-31.BAT. Now it should be clear? This is the reason why the first batch file above must be called this name.

In fact, when you learn to use batch processing, many unimaginable functions can be realized with it. Batch processing that seems simple and outdated (in fact, the use skills of batch processing are the essence of DOS). If used well, it will produce unexpected effects. Hehe. Also, the premise for the above program to execute successfully is that there should be the FIND external command on the system, and the date display format on this computer should also be correct
Floor5 zhri Posted 2004-05-17 00:00
高级用户 Posts 153 Credits 665
......

......

It's more convenient to write a background program yourself and call it at a certain time

......
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023