仅在日...批处理文件时执行 [英] only do if day... batch file
本文介绍了仅在日...批处理文件时执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我得到了一个批处理文件,像这样:
hello i got a batch file, something like this:
if %day%==monday, tuesday, wednesday, thursday, friday (
goto yes
) else (
goto no
)
现在我知道第一行不起作用.
Now i know the first line won't work.
我实际上想发生的事情:
What i actually want to happen:
它会自动检查是哪一天.如果是周一至周五,则必须设置为是",否则(周六/周日)设置为否".
It automatticly checks which day it is. If it is Monday to Friday, it has to go to 'yes', otherwise (saturday/sunday) to 'no'.
该怎么做?
推荐答案
我在网上遇到了这个问题.经过测试,并且有效.以整数形式返回日期,您仍然可以使用该日期.
I ran across this online. Tested, and it works. Returns the day as an integer, which you can still work with.
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
Set Month=%%A
Set Day=%%B
Set Year=%%C
)
@echo DAY = %Day%
@echo Month = %Month%
@echo Year = %Year%
这篇关于仅在日...批处理文件时执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文