


How to use the schtasks command to manage scheduled tasks in Windows
Aug 01, 2025 am 06:09 AMTo view all scheduled tasks, use schtasks; for detailed info, use schtasks /query; for specific formats, use /fo LIST, CSV, or TABLE; to view a specific task, use schtasks /query /tn "TaskName" with the full hierarchical name. 2. To create a task, use schtasks /create /tn "TaskName" /tr "path" /sc schedule /st time, optionally adding /sd, /ru, /rp, and /f; for example, schedule a weekly backup with specific days and SYSTEM account. 3. To run a task immediately, use schtasks /run /tn "TaskName"; to stop it, use schtasks /end /tn "TaskName"; to delete, use schtasks /delete /tn "TaskName", adding /f to force without confirmation. 4. To modify a task, use schtasks /change to update the run path, user, or password, but to change schedule, delete and recreate the task using /create /f. Key tips include using exact task names, quoting paths with spaces, leveraging SYSTEM account to avoid logon issues, verifying tasks in GUI if issues arise, and exporting/importing tasks via XML for deployment across systems, ensuring reliable automation through command-line control.
The schtasks
command in Windows is a powerful command-line tool that lets you create, modify, view, and delete scheduled tasks. It's useful for automating scripts, managing maintenance tasks, or troubleshooting scheduled jobs—especially on servers or in scripts where GUI access isn't available.

Here’s how to use schtasks
effectively for common task management operations.
1. Viewing Scheduled Tasks
To list all scheduled tasks on the system:

schtasks
For more detailed information, including the next run time and status:
schtasks /query
To see tasks in a table format with specific columns:

schtasks /query /fo LIST
Or in CSV format (useful for exporting):
schtasks /query /fo CSV > tasks.csv
To view a specific task:
schtasks /query /tn "TaskName"
Replace "TaskName"
with the actual name of the task. Task names are hierarchical, like \Microsoft\Windows\Defrag\ScheduledDefrag
.
2. Creating a Scheduled Task
Use schtasks /create
to define a new task.
Basic syntax:
schtasks /create /tn "TaskName" /tr "C:\path\to\script.bat" /sc DAILY /st 09:00
/tn
– Task name (required)/tr
– Task to run (program or script path)/sc
– Schedule (e.g.,ONCE
,DAILY
,WEEKLY
,MONTHLY
,MINUTE
)/st
– Start time (24-hour format, e.g.,09:30
)/sd
– Start date (optional, format:MM/DD/YYYY
)/ru
– User account to run the task (e.g.,SYSTEM
orDOMAIN\User
)/rp
– Password (if user requires one)/f
– Force overwrite if task already exists
Example: Run a backup script every weekday at 8 PM
schtasks /create /tn "WeeklyBackup" /tr "C:\Scripts\backup.bat" /sc WEEKLY /d MON,TUE,WED,THU,FRI /st 20:00 /ru SYSTEM /f
Note: Running as
SYSTEM
avoids password prompts and is common for admin tasks.
3. Running, Stopping, and Deleting Tasks
- Run a task immediately:
schtasks /run /tn "TaskName"
Useful for testing without waiting for the schedule.
- Stop a currently running task:
schtasks /end /tn "TaskName"
- Delete a task:
schtasks /delete /tn "TaskName"
You’ll be prompted to confirm. Add /f
to force deletion without confirmation:
schtasks /delete /tn "TaskName" /f
4. Modifying or Updating a Task
You can't directly "edit" a task, but you can recreate it with /create /f
to overwrite.
Alternatively, use /change
to update certain properties:
schtasks /change /tn "TaskName" /tr "C:\New\Script.bat" /ru "DOMAIN\User" /rp "Password123"
This changes the program to run and the user account, but doesn't alter the schedule.
For full changes (like frequency or time), you’ll need to delete and recreate the task.
Common Pitfalls & Tips
- Task names are case-sensitive in behavior: While they may display in mixed case, referencing them incorrectly can cause errors. Use exact names from
/query
. - Paths with spaces: Always wrap paths in quotes:
/tr "C:\My Scripts\run.bat"
- Run whether user is logged on or not: The GUI option isn't directly available in
schtasks
, but you can achieve it using/ru
with a user and/rp
, or by usingschtasks
in combination with XML import (advanced). - Use Task Scheduler GUI to inspect: If a command-created task isn’t behaving, open Task Scheduler to verify triggers, conditions, and security options.
Bonus: Export and Import Tasks (Advanced)
You can export a task to XML via GUI or command:
schtasks /query /tn "TaskName" /xml > task.xml
Then import it on another machine:
schtasks /create /tn "TaskName" /xml task.xml
This is great for deploying consistent tasks across multiple systems.
Using schtasks
gives you precise control over automation in Windows environments—especially useful in batch scripts, remote administration, or unattended setups.
Basically, once you know the key switches (/tn
, /tr
, /sc
, /st
), most tasks become just a one-liner. Just remember to test with /run
after creating.
The above is the detailed content of How to use the schtasks command to manage scheduled tasks in Windows. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The scheduled task is scheduled to execute atat at a specified time point at a time, and the one-time task depends on the atd service. It needs to be started to realize the at task. The at queue is stored in the /var/spool/at directory -V: Display version information -l: List the specified queue Jobs waiting to be run; equivalent to atq-d: delete the specified job; equivalent to atrm-c: view specific job tasks [root@localhost~]#systemctlstartatd[root@localhost~]#systemctlenableatd[root@localhost~]# atnow+1minat>useraddxwzat>#

Laravel is a popular PHP framework that provides great support for web application development. One of the powerful and useful features is LaravelTaskScheduling. This article will introduce how to use LaravelTaskScheduling to perform scheduled tasks. 1. What is LaravelTaskScheduling scheduled task? LaravelTaskScheduling is

With the rapid development of the Internet, more and more websites and applications need to perform some scheduled tasks and planned tasks in the background, such as data cleaning, backup, statistical analysis, etc. As a popular web development language, PHP also provides corresponding scheduled task and planned task technology. This article will introduce the scheduled task and planned task technology in PHP in detail. 1. Concept and usage scenarios of scheduled tasks 1.1 Concept Scheduled tasks refer to automatically executing some specified tasks or operations within a specified time point or time interval. 1.2 make

Most users don’t know what the scheduled power on and off setting method for windows 7 is. Specifically, win7 can be set to automatically shut down, but users don’t know how to set it up. In fact, it can be set by entering a simple code, and you need to use cmd to set it up. The following is an introduction to the actual Windows 7 timer power on and off setting method. Users can refer to it and set it up, which is very simple. What is the method to set the timer on and off of Windows 7? 1. Set automatic shutdown. In fact, it can only be done from within the capabilities of the system itself, i.e. entering the shutdown command in the action box. Open the menu bar and click Action. If not, just press the shortcut key to open it, win+r to open it. 2. For example, if we want to turn off the power after three hours

Timing tasks and planned task management of PHP and small programs With the continuous development of Internet technology, many websites and applications need to perform certain tasks regularly, such as data cleaning, data analysis, data synchronization, etc. In PHP and small program development, how to manage scheduled tasks and planned tasks is an important topic. This article will introduce how to use PHP and applets to manage timed tasks and planned tasks, and give corresponding code examples. Scheduled task management in PHP In PHP, we can use Cron to manage scheduled tasks.

How to implement scheduled tasks and scheduled tasks through the Webman framework? Webman is a lightweight web framework developed based on Go language. It provides a simple way to implement scheduled tasks and planned tasks. This article will introduce how to use the Webman framework to implement timed tasks and scheduled tasks, and provide corresponding code examples. Before using the Webman framework, you need to install Webman first. Webman can be installed with the following command: gogetgithub.com/he

We often see words that start a project. In fact, this is the scheduled task setting in our computer. When our computer starts, these scheduled tasks will start with the Win7 system. Some tasks may have to be started, but others don't. In this regard, we can set up these scheduled tasks. Let's see the detailed operation. 1. First, we can find the start menu bar on the computer. In the Start menu, we can see related options, find the Control Panel option and click to enter. 2. After entering the computer's control panel, we can see the system and security options. In the first row of the current page, click the button and open it. 3. After entering the system and security options of the computer control panel, we can find the administrative tools button at the bottom.

Yes,youcanrunacustomSQLscriptonascheduleusingNavicatbyutilizingitsbuilt-inSchedulerfeature.1.OpenyourdatabaseconnectionandgotoTools>CreateScheduler.2.NamethetaskandundertheActionstab,selectRunSQLFileorRunSQLStatement,thenspecifyyourscript.3.IntheS
