How to Use the schtasks Command to Schedule Background Tasks in Windows 11

The Problem with the Task Scheduler UI

In Windows 11, if you want a program to run automatically every day at 3:00 AM, the standard approach is to open the graphical Task Scheduler application, click “Create Basic Task,” and navigate through a series of wizard menus.

While the graphical interface is fine for home users, it is completely useless for system administrators who need to deploy a scheduled backup script to 500 employee laptops simultaneously. You cannot sit down at 500 computers and click through a wizard.

The schtasks command is the native, command-line version of the Task Scheduler. It allows you to create, delete, query, and modify scheduled tasks instantly from the Command Prompt, making it perfect for automated deployment scripts.

Step 1: Open the Command Prompt

Because creating scheduled tasks allows software to run automatically in the background, you must execute these commands with administrator privileges.

  1. Press the Windows Key, type cmd.
  2. Right-click on Command Prompt and select Run as administrator.

Step 2: Creating a Daily Scheduled Task

To create a new task, you must use the /create switch, followed by a series of flags that define the task’s behavior.

Assume you have a PowerShell backup script located at C:\Scripts\backup.ps1, and you want Windows to automatically run it every single day at 5:00 PM.

Type the following command:

schtasks /create /tn "DailySystemBackup" /tr "powershell.exe -file C:\Scripts\backup.ps1" /sc daily /st 17:00

Breaking down the command:

  • /tn (Task Name): The name of the task as it will appear in the Task Scheduler list (DailySystemBackup).
  • /tr (Task Run): The actual program or script you want Windows to execute. If it is a script, you must call the interpreter (like powershell.exe) first.
  • /sc (Schedule): How often the task should run (daily, weekly, monthly, once, or onlogon).
  • /st (Start Time): The exact time the task should trigger, formatted in 24-hour military time (17:00).

When you press Enter, the terminal will reply: SUCCESS: The scheduled task “DailySystemBackup” has successfully been created.

Step 3: Creating a Task that Runs on Startup

Sometimes you don’t care what time it is; you just want a program to launch the moment the computer boots up, before any user has even logged in.

schtasks /create /tn "StartupMonitor" /tr "C:\Tools\monitor.exe" /sc onstart /ru SYSTEM

Notice the /ru (Run As User) flag at the end. By assigning the task to the SYSTEM account, Windows will execute the program silently in the background at the highest possible privilege level, completely independent of whatever human user logs into the machine.

Step 4: Querying and Deleting Tasks

To verify that your task was successfully added to the master schedule, you can query the system.

schtasks /query /tn "DailySystemBackup"

This will output a small table showing the task name, the next exact date and time it is scheduled to run, and the status (Ready).

If you made a mistake, or if the script is no longer needed, you can delete the task entirely from the system using the /delete switch. You must include the /f (force) flag to bypass the “Are you sure?” confirmation prompt, which is essential when writing automated uninstall scripts.

schtasks /delete /tn "DailySystemBackup" /f

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.