@echo off chcp 65001 >nul REM 检查自动任务执行脚本运行状态 echo ================================================ echo 检查自动任务执行服务状态 echo ================================================ echo. REM 切换到项目根目录 cd /d %~dp0.. REM 使用PowerShell检查进程 echo [服务状态] powershell -Command "$processes = Get-WmiObject Win32_Process | Where-Object { $_.CommandLine -like '*auto_execute_tasks.py*' }; if ($processes) { Write-Host '[运行中] 找到以下进程:' -ForegroundColor Green; $processes | ForEach-Object { Write-Host (' 进程ID: ' + $_.ProcessId + ' 启动时间: ' + $_.CreationDate) } } else { Write-Host '[未运行] 未找到auto_execute_tasks.py进程' -ForegroundColor Yellow }" echo. echo ================================================ echo 查看最近日志(最后20行) echo ================================================ echo. if exist "logs\auto_execute.log" ( powershell -Command "Get-Content logs\auto_execute.log -Tail 20 -ErrorAction SilentlyContinue" ) else ( echo [提示] 日志文件不存在,脚本可能未运行或使用标准输出 ) echo. echo ================================================ echo 检查pending_tasks.json状态 echo ================================================ echo. if exist ".cursor\pending_tasks.json" ( echo [文件存在] .cursor\pending_tasks.json powershell -Command "$tasks = Get-Content '.cursor\pending_tasks.json' -Raw -ErrorAction SilentlyContinue | ConvertFrom-Json; if ($tasks) { Write-Host (' 任务数量: ' + $tasks.Count); $tasks | ForEach-Object { Write-Host (' - [' + $_.task_id + '] ' + $_.task_name + ' (' + $_.status + ')') } } else { Write-Host ' [空] 没有待处理任务' }" ) else ( echo [提示] pending_tasks.json 不存在 ) echo. echo ================================================ echo 是否执行一次手动检查?(Y/N) echo ================================================ echo. set /p choice="请输入选择: " if /i "%choice%"=="Y" ( echo. echo [执行] 手动运行一次任务检查... python scripts\auto_execute_tasks.py --once ) echo. pause