Re Bone Ash Dragon:
You didn't say what system and environment you're using, and I'm also very unfamiliar with the NT-series environment, so I can't judge whether your date format is right or wrong. I can only reply regarding the following issue:
@echo off
if %date% == "2002.1.1" goto del
rem As xiaojun said, the use of the jump statement here is problematic.
rem Because according to your code, whether the condition is true or not, it will directly execute the del block below.
rem That's why it runs deltree regardless of the condition.
rem And your %date%=="2002.1.1" also seems to be problematic.
rem Unless the original value of the date variable contains quotation marks, this way of adding quotes only to the latter value is wrong.
rem It should instead be changed to "%date%"=="2002.1.1".
rem Also, the data variable is not directly provided by the system in all environments; for example, in 98 it needs to be obtained manually.
:del
deltree %temp%\*.*
:end
exit
※ Batchinger 致 Bat Fans:请访问
批处理编程的异类 ,欢迎交流与共享批处理编程心得!