Task Scheduler - kalhoralireza/RunForever GitHub Wiki

Task Scheduler

Task Scheduler is a built-in Windows component that allows users and system administrators to schedule automated tasks to run at specific times, intervals, or in response to certain triggers (e.g., system events or user actions). These tasks can execute programs, scripts, or commands.

How to run?

Syntax

schtasks /create /sc <scheduletype> /tn <taskname> /tr <taskrun> /ru {[<domain>\]<user> | system}
  • /tn: Task name
  • /tr: task to run
  • /sc: Schedule type (e.g., onlogon, onstart)
  • /ru: Run as a specific user (SYSTEM grants high privileges)

Examples

  • Scheduled Tasks for Startup Execution (Adminstrator):
schtasks /create /tn "<any-name>" /tr "<path-to-binary>" /sc onlogon /ru SYSTEM
  • Scheduled Tasks to run when the system is idle:
schtasks /create /tn "<any-name>" /tr "<path-to-binary>" /sc onidle /i "<idle-time-in-minutes>"
  • Scheduled Tasks to run every <n> minutes:
schtasks /create /sc minute /mo <n> /tn "<any-name>" /tr "<path-to-binary>"
  • Scheduled Tasks to run every <n> hours:
schtasks /create /sc hourly /mo <n> /tn "<any-name>" /tr "<path-to-binary>"
  • Scheduled Tasks to run every <n> days:
schtasks /create /sc daily /mo <n> /tn "<any-name>" /tr "<path-to-binary>"
  • Deleting a scheduled task:
schtasks /delete /tn "<Task-Name>"

References

⚠️ **GitHub.com Fallback** ⚠️