一、关闭进程并启动应用bat脚本
start.bat
@echo off
rem 关闭指定进程
taskkill /f /im test.exeset "logFile=Windows\test\Saved\Logs\*.log"
rem 如果存在日志文件则删除日志文件
if exist "%logFile%" (del "%logFile%"echo delete success
) else (echo file not exist,Unable to delete
)rem 启动应用
start "" "Windows\test.exe"exit
二、特定时间执行以上脚本的bat脚本
timer_start.bat
@echo off
setlocal enabledelayedexpansionrem 启动start.bat脚本
start "" "start.bat"rem 设置指定的执行时间,格式为 "HH:MM:SS"
set target_time=23:58:00rem 循环
:mainloop
rem 获取当前系统时间
for /f "tokens=1-3 delims=:" %%a in ('time /t') do (set current_time=%%a:%%b:%%cecho %%a:%%b:%%c
)rem 比较当前时间与指定时间
if "%current_time%" geq "%target_time%" (echo 当前时间已经大于或等于指定时间,执行你的程序rem 在这里添加要执行的程序的命令start "" "start.bat"
)rem 等待5秒
timeout /t 60 /nobreak >nulgoto :mainloop
注:脚本start.bat可以单独使用,也可以配合脚本timer_start.bat一起使用