可用系统命令 schtasks 计划完成,批处代码如下...- @echo off &setlocal enabledelayedexpansion
- for %%s in ( "01/03", "13/15", "18/20" ) do for /f "tokens=1,2 delims=/" %%a in (%%s) do (
- set/a "n+=1"
- schtasks /create /tn task!n! /tr "D:\test.bat" /sd 11/%%a/2024 /ed 11/%%b/2024 /st 12:30:00
- set/a "n+=1"
- schtasks /create /tn task!n! /tr "D:\test.bat" /sd 11/%%a/2024 /ed 11/%%b/2024 /st 17:30:00
- )
- endlocal&pause&exit/b
复制代码
其中 "D:\test.bat" 即为计划定时运行的批处脚本路径,其内容例如一楼代码中的段落:- for %%i in (*D11*) do (
- echo %%i
- start "" /w excel.exe "%%i" /batOpen
- )
复制代码