Windows Task Builder
Fill in the blanks and get a complete schtasks /create command — schedule dropdowns, correct quoting, and a copy button. Plus a searchable Last Run Result code reference for tasks that fail.
Fill in the blanks — the schtasks /create command assembles live below.
The form adapts to the schedule type you pick.
The ~1 suffix is Windows' usual default, but real
short names depend on the filesystem (and 8.3 names can be disabled). Confirm on
the target machine with:
The /sd and /ed date format follows the
machine's regional settings (MM/DD/YYYY on US-locale systems). Creating tasks that run
as SYSTEM or with highest privileges requires an elevated prompt. A custom account will
be prompted for its password when the command runs.
Last Run Result codes
When a scheduled task fails silently, Task Scheduler records a hex Last Run
Result — the column in taskschd.msc, or the Last Result
line from schtasks /query /tn "Name" /v /fo LIST. Search a code or keyword
to see what it means and how to fix it. 0x0 is success; anything else is
either the program's own exit code or a Task Scheduler SCHED_* constant.
| code | constant | meaning | severity |
|---|
No codes match those filters.
task scheduler 101
Task Scheduler and schtasks
Windows Task Scheduler is the service behind every scheduled job on Windows —
what cron is to Unix. schtasks.exe is its command-line face; the GUI
(taskschd.msc) and PowerShell's
Register-ScheduledTask manage the same task store. Tasks live in a
folder tree — name a task \MyFolder\MyTask to keep things organized.
The verbs
| command | what it does |
|---|---|
schtasks /create … | create a task (what this tool builds) |
schtasks /query /tn "Name" /v /fo LIST | inspect a task — status, last/next run, last result |
schtasks /run /tn "Name" | run it right now (great for testing) |
schtasks /end /tn "Name" | stop a running instance |
schtasks /change /tn "Name" … | modify an existing task |
schtasks /delete /tn "Name" /f | remove it |
The flags this tool generates
| flag | meaning |
|---|---|
/tn | task name (quote it if it has spaces) |
/tr | the program to run, with its arguments |
/sc | schedule type: MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE |
/mo | modifier — "every N" for time schedules, or FIRST/SECOND/THIRD/FOURTH/LAST/LASTDAY for monthly patterns |
/d / /m | days (MON-SUN or 1-31) and months (JAN-DEC) |
/st / /sd / /ed | start time (24h HH:MM), start date, end date |
/ru / /rp | the account the task runs as, and its password (SYSTEM needs none) |
/rl HIGHEST | run elevated ("highest privileges" — the checkbox in the GUI) |
/f | overwrite an existing task with the same name |
/i | idle minutes to wait (ONIDLE only) |
Quoting — the part everyone gets wrong
The whole /tr value needs outer double quotes, and if the program
path itself contains spaces it needs its own escaped quotes inside:
/tr "\"C:\Program Files\App\run.exe\" --flag value"
Get this wrong and Windows tries to run C:\Program with
Files\App\run.exe as an argument. Two reliable escapes: the nested-quote
form above (this tool generates it for you), or dodge the problem entirely with an
8.3 short name like C:\PROGRA~1\App\run.exe — spaceless,
so no inner quotes needed. Short names are assigned by the filesystem, so confirm the
real one with for %I in ("C:\path with spaces\x.exe") do @echo %~sI
(they can also be disabled system-wide).
Gotchas worth knowing
- Elevation — creating tasks that run as SYSTEM, as another user,
or with
/rl HIGHESTrequires an elevated (Administrator) prompt. - Date format —
/sdand/edfollow the machine's regional settings: MM/DD/YYYY on US systems, DD/MM/YYYY elsewhere. A "working" command can break on a differently-configured server. - Last Run Result —
0x0means success;0x1usually means the program wasn't found or returned 1 (often a quoting problem);0x41303means "has not yet run". The searchable Last Run Result codes table below the builder decodes these and the rest, with a fix for each. - Password changes — a task registered with
/ru userstores credentials; when that password changes, the task quietly stops running until it's re-registered. - Working directory — schtasks gives you no flag for it; tasks
start in
System32. Use absolute paths inside your scripts, orcd /dfirst in a wrapper.cmd.