@echo off
REM Check the status of CNPERP Auto-Update scheduled task

echo Checking CNPERP Auto-Update Scheduled Task Status...
echo.
echo ========================================

PowerShell -Command ^
  "$task = Get-ScheduledTask -TaskName 'CNPERP-Auto-Update' -ErrorAction SilentlyContinue; " ^
  "if ($task) { " ^
    "'Task Found: YES'; " ^
    "'Status: ' + $task.State; " ^
    "'Path: ' + $task.TaskPath; " ^
    "'Trigger: ' + @($task.Triggers)[0].StartBoundary; " ^
    "'Last Run: ' + (Get-ScheduledTaskInfo -TaskName 'CNPERP-Auto-Update').LastRunTime; " ^
    "'Last Result: ' + (Get-ScheduledTaskInfo -TaskName 'CNPERP-Auto-Update').LastTaskResult; " ^
  "} else { " ^
    "'Task Found: NO'; " ^
    "'Please run setup_auto_update.bat to create the scheduled task.'; " ^
  "}"

echo.
echo ========================================
echo.
pause
