@echo off :: 查找并停止所有运行 scheduler.py 的 pythonw 进程 for /f "tokens=2" %%a in ('tasklist /fi "imagename eq pythonw.exe" /v ^| findstr "scheduler.py"') do taskkill /F /PID %%a :: 等待1秒确保进程完全停止 timeout /t 1 /nobreak > nul :: 启动新的进程 start /min pythonw "%~dp0scheduler.py"