『第 4 楼』:
使用 LLM 解释/回答一下
我把转帖保存成了文本,原帖子链接已经丢失,用time命令也是一个道理。。。
例如,要在12月31日这一天执行某个命令,可以这样做:
1,建立一个批处理,文件名叫12-31.bat,注意文件名是你要执行的日期,
因为这个文件名后面要用到。内容是你所要做的一切。
2,建立第二个批处理,这个文件名可以随意,例如run.bat(这一步好象也
可以省略,因为如果这个文件不存在,第三步应该会自动生成)
3,在AUTOEXEC.BAT中加入这几句
echo.|date|find "12-31">run.bat
call run.bat
看懂了吗?不懂的话再听我说
在AUTOEXEC中执行echo.|date|find "12-31">run.bat的结果就是执行DATE
命令,这个命令是用于显示或修改日期,由于这个命令要等待键盘的输入,所
以前面用ECHO.来给这个命令一个回应。然后,在DATE命令的输出中查找12-31
这个日期,并且把结果存入RUN这个批处理程序中。如果当天不是12月31日,
那么结果没有任何东西放进RUN这个批处理中,所以里面什么也没有,这两行
执行的结果相当于什么也不做。如果当天是12月31日,那么结果会把“12-31”
这个字串存入到RUN这个程序里面,接着下一行调用这个RUN批处理,如果前
一步的结果把12-31这个字串存入RUN里面了,那么这个时候其实执行RUN就是
执行12-31.BAT了,这下应该明白了吧?这就是上面第一步这个批处理一定要
叫这个名字的原因。
其实学会使用批处理,很多难以想象的功能都可以用它来实现的,看似简单和
过时的批处理(其实批处理的使用技巧就是DOS的精华),用得好却会产生意
想不到的效果。呵呵。还有,上面程序执行成功的前提是该系统上应该有FIND
这个外部命令,另外该机上的日期显示格式也要正确
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
|