How to Schedule a Task Using Command Prompt in Windows 11
Scheduling a task from the command line automates running a program or script at a set time or trigger, without using the Task Scheduler interface. Windows 11’s `schtasks` command creates scheduled YYGACOR Login tasks directly.
The Command
schtasks /create /tn "MyTask" /tr "C:\Scripts\backup.bat" /sc daily /st 09:00
What It Does
This creates a scheduled task named MyTask that runs the specified batch file daily at 9:00 AM. `/tn` sets the task name, `/tr` the program to run, `/sc daily` the schedule frequency, and `/st` the start time. Together they define an automated task that Windows runs on the schedule you set without further input.
When You’d Use This
This is useful for automating recurring tasks like backups, cleanup scripts, or maintenance routines that should run on a schedule without manual intervention. Creating tasks by command is convenient in setup scripts and lets you define exactly when and what runs, whether daily, weekly, at logon, or at startup, so routine jobs happen reliably on their own.
Useful Variations
Change `/sc` to weekly, monthly, onlogon, or onstart for different triggers, and adjust `/st` for the time. To run a task with highest privileges, add `/rl highest`. To delete a task later, `schtasks /delete /tn “MyTask”` removes it. To run it immediately for testing, `schtasks /run /tn “MyTask”` triggers it.
If It Doesn’t Work
Creating tasks that run elevated or at startup may require an administrator terminal. Test the task by running it manually with `schtasks /run /tn “MyTask”` to confirm the program path and behavior are correct before relying on the schedule. If the task does not run as expected, verify the program path is right and consider fine-tuning it in the graphical Task Scheduler, which shows detailed run history.
Good to Know
Creating tasks that run with elevated privileges or at system startup may require an administrator command line. Test the task by running it manually first to confirm the program path and behavior are correct. The Task Scheduler app can then be used to review or fine-tune the task through a graphical interface if needed.
Putting It Together
The command shown may look dense at first, but it breaks down into clear parts once you have used it a few times. As part of keeping Windows healthy and automating upkeep, this command is part of the maintenance routine that resolves problems and prevents them. Combined with the related service and repair commands, it gives you direct control over the background machinery that keeps the system running well. Like anything in the terminal, the real value comes from trying it on your own system and adapting the variations above to what you actually need, so it is worth experimenting with in a safe, low-stakes situation before relying on it in a script or during troubleshooting. Keeping a note of the commands you find most useful, along with the variations that fit your workflow, turns scattered one-off tricks into a personal reference you can draw on whenever a similar task comes up again.