batch-file - 仅在日...批处理文件时执行

标签 batch-file goto

你好,我得到了一个批处理文件,像这样:

if %day%==monday, tuesday, wednesday, thursday, friday (
goto yes
) else (
goto no
)

现在我知道第一行是行不通的。

我实际上想发生的事情:

它会自动检查是哪一天。如果是周一至周五,则必须设置为"is",否则(周六/周日)设置为“否”。

这该怎么做?

最佳答案

我在网上遇到了这个问题。经过测试,并且有效。以整数形式返回日期,您仍然可以使用该日期。

@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%

关于batch-file - 仅在日...批处理文件时执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/935858/

相关文章:

batch-file - 批处理 : Set one directory up path in variable

Windows 批处理文件启动带有按钮的 gui

windows - 批处理文件 (windows cmd.exe) 测试目录是否为链接 (symlink)

batch-file - 使用批处理文件列出 csv 上的文件名和文件夹路径

c - Eclipse 转到标签在 C 中不起作用

algorithm - 自动 GOTO 删除算法

c++ - C++ 中格式错误的 goto 跳转,编译时已知为假条件 : is it actually illegal?

python - label/GOTO 或 python3 中的类似函数

javascript - 在批处理文件中嵌入 JS 代码

c++ - 如何在不使用 goto 的情况下重写它