Files
RPA-ROBOT/register_task.bat

39 lines
1.1 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
chcp 65001 >nul
setlocal
set TASK_NAME=RPA_Feishu_Chat_Backup
set SCRIPT_DIR=%~dp0
set SCRIPT_PATH=%SCRIPT_DIR%run_feishu_chat.bat
echo ========================================
echo 注册 Windows 定时任务
echo ========================================
echo 任务名称 : %TASK_NAME%
echo 执行脚本 : %SCRIPT_PATH%
echo 执行时间 : 每天 06:03
echo.
REM /sc daily : 每天执行
REM /st 06:03 : 早上6点03分
REM /it : 仅在用户登录时交互式运行RPA操作GUI必需
REM /f : 覆盖已存在的同名任务
schtasks /create /tn "%TASK_NAME%" /tr "\"%SCRIPT_PATH%\"" /sc daily /st 18:03 /it /f
if %errorlevel% equ 0 (
echo.
echo [成功] 定时任务已注册!
echo.
echo 管理命令:
echo 查看任务: schtasks /query /tn "%TASK_NAME%"
echo 立即运行: schtasks /run /tn "%TASK_NAME%"
echo 删除任务: schtasks /delete /tn "%TASK_NAME%" /f
) else (
echo.
echo [失败] 注册失败,请确认权限。
)
echo.
pause
endlocal