China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 11:13
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to run a batch file during a specified time period View 2,753 Replies 4
Original Poster Posted 2003-11-07 00:00 ·  中国 江苏 镇江 电信
初级用户
Credits 107
Posts 1
Joined 2003-11-04 00:00
22-year member
UID 12406
Gender Male
Status Offline
QQ:832686
Thanks. ...
Floor 2 Posted 2003-12-06 00:00 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
Using the at command
Floor 3 Posted 2004-05-15 00:00 ·  中国 湖南 岳阳 电信
初级用户
Credits 108
Posts 4
Joined 2004-05-15 00:00
22-year member
UID 24363
Gender Male
Status Offline
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?
Floor 4 Posted 2004-05-16 00:00 ·  中国 河南 安阳 联通
银牌会员
★★★
Credits 1,186
Posts 334
Joined 2003-05-30 00:00
23-year member
UID 2626
Gender Male
Status Offline
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
Floor 5 Posted 2004-05-17 00:00 ·  中国 上海 鹏博士宽带
高级用户
★★
zhri
Credits 665
Posts 153
Joined 2004-02-23 00:00
22-year member
UID 18241
Gender Male
Status Offline
......

......

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

......
Forum Jump: