Skip to content

Instantly share code, notes, and snippets.

@rdapaz
Created March 18, 2026 15:07
Show Gist options
  • Select an option

  • Save rdapaz/4a8496f100d902468bbfb799d3428f99 to your computer and use it in GitHub Desktop.

Select an option

Save rdapaz/4a8496f100d902468bbfb799d3428f99 to your computer and use it in GitHub Desktop.
Windows Task Scheduler Chet Sheet

Windows Task Scheduler Cheat Sheet

Create a Scheduled Task

Simple (no spaces in paths):

schtasks /Create /TN "TaskName" /TR "C:\path\to\script.bat" /SC MINUTE /MO 15 /F

With spaces in paths — use a .bat wrapper (avoids nested quote nightmares):

  1. Create a run_task.bat:
@echo off
"C:\path to\python.exe" "D:\path to\script.py" --arg "C:\path with spaces\value"
  1. Schedule the .bat:
schtasks /Create /TN "MyTask" /TR "D:\path\to\run_task.bat" /SC MINUTE /MO 15 /F

Common Flags

Flag Meaning
/TN "Name" Task name
/TR "command" Command to run
/SC MINUTE Schedule type (MINUTE, HOURLY, DAILY, WEEKLY)
/MO 15 Modifier (e.g. every 15 minutes)
/F Force overwrite if task already exists

Verify

# Quick status
schtasks /Query /TN "MyTask"

# Detailed view
schtasks /Query /TN "MyTask" /V /FO LIST

Run Immediately (test)

schtasks /Run /TN "MyTask"

Delete

schtasks /Delete /TN "MyTask" /F

List All Tasks (filter)

schtasks /Query /FO TABLE | findstr "MyTask"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment