CMD Simulator
Process Managementschtasks

SCHTASKS Command – Schedule Tasks in Windows CMD

Learn how to use the SCHTASKS command to create, manage, and query scheduled tasks in Windows CMD. Guide covers /create, /query, /run, syntax, and automation examples.

Rojan Acharya·
Share

The SCHTASKS command is a Windows Command Prompt utility that enables administrators to create, delete, query, change, run, and end scheduled tasks from the command line. Use SCHTASKS /create to schedule scripts and programs, SCHTASKS /query to list tasks, or SCHTASKS /run to execute a task immediately—essential for automation, maintenance scripts, and enterprise task management.

Whether you're a system administrator automating backups and maintenance, a developer scheduling build or deployment jobs, or an IT professional managing recurring tasks across servers, SCHTASKS provides full command-line access to the Windows Task Scheduler. Automation engineers rely on SCHTASKS for scripted task deployment, remote task management, and consistent scheduling across enterprise environments.

This comprehensive guide covers SCHTASKS syntax, create/query/run/delete operations, practical examples for common scenarios, troubleshooting tips, related commands, and frequently asked questions. By the end, you'll confidently use SCHTASKS for task automation and scheduling in Windows environments.

What Is the SCHTASKS Command?

The SCHTASKS command is the command-line interface to the Windows Task Scheduler. It creates and manages scheduled tasks that run programs, scripts, or commands at specified times or in response to events. SCHTASKS replaces the older AT command and provides more flexibility. It is available in Windows XP and later, including Windows 10, Windows 11, and all Windows Server editions.

SCHTASKS supports local and remote computer management, multiple trigger types (daily, weekly, monthly, at logon, at startup), and different user contexts. Tasks can run whether the user is logged on or not, making SCHTASKS ideal for server maintenance, backup jobs, and automated reporting.

SCHTASKS vs AT Command

  • SCHTASKS: Modern; full-featured; XML-based; supports all trigger types
  • AT: Legacy; limited; simpler syntax; deprecated in favor of SCHTASKS
  • Use SCHTASKS for all new task scheduling. AT is deprecated.

Syntax

SCHTASKS /Create | /Delete | /Query | /Change | /Run | /End | /ShowSid

Parameters

ParameterDescription
/CreateCreates a new scheduled task
/DeleteDeletes a scheduled task
/QueryDisplays scheduled tasks
/ChangeModifies an existing task
/RunRuns a task immediately
/EndStops a running task
/ShowSidShows task SID and run level

Create Options

OptionDescription
/TN tasknameTask name (required for /Create)
/TR taskrunProgram/script to run (required)
/SC scheduleSchedule: MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE
/ST starttimeStart time (e.g., 14:30)
/SD startdateStart date (e.g., 03/15/2026)
/RU usernameRun as user
/RP passwordRun as user password
/RL HIGHESTRun with highest privileges

How to Use SCHTASKS Command

Query Existing Tasks

List all scheduled tasks:

SCHTASKS /Query

List tasks in table format with next run time:

SCHTASKS /Query /FO TABLE

Create a Daily Task

Create a task that runs daily at 2:00 AM:

SCHTASKS /Create /TN "DailyBackup" /TR "C:\scripts\backup.bat" /SC DAILY /ST 02:00

Create a Task at Logon

Create a task that runs when any user logs on:

SCHTASKS /Create /TN "LogonScript" /TR "C:\scripts\logon.bat" /SC ONLOGON

Create a Task Running as Different User

Create a task that runs under a specific account:

SCHTASKS /Create /TN "AdminTask" /TR "C:\scripts\admin.bat" /SC DAILY /ST 03:00 /RU DOMAIN\admin /RP password

Run a Task Immediately

Execute a task on demand:

SCHTASKS /Run /TN "DailyBackup"

Delete a Task

Remove a scheduled task:

SCHTASKS /Delete /TN "DailyBackup" /F

Common Use Cases

  1. Automated backups – Schedule backup scripts to run daily or weekly during off-hours.

  2. Maintenance scripts – Run disk cleanup, defragmentation, or log rotation on a schedule.

  3. Deployment automation – Schedule software updates or configuration scripts to run at specific times.

  4. Reporting – Generate and email reports daily or weekly.

  5. Log cleanup – Archive or delete old logs on a recurring schedule.

  6. Health checks – Run monitoring scripts periodically to verify service health.

  7. Build automation – Schedule nightly builds or CI jobs.

  8. User logon scripts – Run scripts when users log on (ONLOGON trigger).

  9. System startup tasks – Run tasks at system boot (ONSTART trigger).

  10. Remote task management – Create and manage tasks on remote computers with /S system.

Tips and Best Practices

  1. Use descriptive task names – Include purpose and schedule in task name (e.g., DailyBackup_2AM).

  2. Test before scheduling – Run the script manually first to ensure it works before scheduling.

  3. Use /RL HIGHEST only when needed – Elevated tasks require careful planning; use least privilege.

  4. Document task purpose – Add description to tasks or maintain runbook for scheduled tasks.

  5. Redirect output in scripts – Scheduled tasks may have no console; use > log.txt 2>&1 in scripts.

  6. Consider time zones – Task times use local system time; ensure correct for your environment.

  7. Use /F with /Delete – /F forces deletion without confirmation for scripted removal.

  8. Verify task creation – Run SCHTASKS /Query after /Create to confirm task exists.

Troubleshooting Common Issues

Task Does Not Run at Scheduled Time

Problem: Scheduled task doesn't execute when expected.

Cause: Computer may be off or asleep; task may be disabled; user account may have password issues; trigger may be misconfigured.

Solution: Run SCHTASKS /Query /TN taskname /V /FO LIST to check task status and last run. Ensure "Next Run Time" is correct. Check Task Scheduler history for errors. Verify task is enabled.

Prevention: Test task with SCHTASKS /Run before relying on schedule. Enable "Wake computer to run task" if computer sleeps during scheduled time.

"Access Denied" When Creating Task

Problem: SCHTASKS /Create fails with access denied.

Cause: Creating tasks requires administrator privileges. Some options (e.g., /RU for different user) require elevated rights.

Solution: Run Command Prompt as Administrator. For domain tasks, ensure you have permission to create tasks on target computer.

Prevention: Document required permissions. Use RUNAS or elevated prompt for task creation.

Task Runs But Script Fails

Problem: Task executes but the script or program fails.

Cause: Script may run in different working directory; environment variables may differ; PATH may not include script location.

Solution: Use full paths for all files in the script. Set working directory in task: /RU "C:\scripts\backup.bat" and ensure script uses absolute paths. Add cd /d C:\scripts at start of script.

Prevention: Use absolute paths in scheduled scripts. Test by running SCHTASKS /Run and checking output.

Password Required for /RU User

Problem: Task with /RU requires password; script fails when password expires.

Cause: Tasks running as specific user must have valid password. Password change breaks the task.

Solution: Use "Run whether user is logged on or not" and "Run with highest privileges" for service-account style tasks. Update password in task when it changes: SCHTASKS /Change /TN taskname /RP newpassword.

Prevention: Use dedicated service accounts with non-expiring passwords for automated tasks. Document password update procedure.

Related Commands

AT – Legacy Task Scheduler

AT is the deprecated predecessor to SCHTASKS. Use SCHTASKS for all new scheduling.

When to use: Legacy systems only. Prefer SCHTASKS.

TASKLIST – Process Listing

TASKLIST shows running processes. Use to verify a scheduled task's process is running.

When to use: Verify task execution. See TASKLIST command guide.

SC – Service Control

SC manages Windows services. Use services for long-running daemons; use SCHTASKS for scheduled or recurring jobs.

When to use: Persistent services vs. scheduled tasks.

TASKKILL – Process Termination

TASKKILL terminates processes. Use SCHTASKS /End to stop a task, or TASKKILL to stop a runaway process.

When to use: Stopping tasks vs. killing specific processes.

Frequently Asked Questions

What does the SCHTASKS command do?

SCHTASKS creates, deletes, queries, changes, runs, and ends scheduled tasks in Windows. It is the command-line interface to the Windows Task Scheduler, allowing automation of scripts and programs.

How do I create a scheduled task with SCHTASKS?

Use SCHTASKS /Create /TN "TaskName" /TR "program_or_script" /SC schedule /ST time. For example: SCHTASKS /Create /TN "Backup" /TR "C:\backup.bat" /SC DAILY /ST 02:00. Replace schedule with DAILY, WEEKLY, HOURLY, etc.

How do I list all scheduled tasks?

Run SCHTASKS /Query to list all tasks. Use SCHTASKS /Query /FO TABLE for table format or SCHTASKS /Query /FO LIST for detailed list format. Use SCHTASKS /Query /TN "TaskName" for a specific task.

How do I run a scheduled task immediately?

Use SCHTASKS /Run /TN "TaskName". Replace TaskName with the actual task name. The task runs immediately regardless of its schedule.

How do I delete a scheduled task?

Use SCHTASKS /Delete /TN "TaskName" /F. The /F flag suppresses confirmation. Without /F, you'll be prompted to confirm.

What is the difference between SCHTASKS and Task Scheduler GUI?

SCHTASKS is the command-line interface; Task Scheduler (taskschd.msc) is the graphical interface. Both manage the same tasks. Use SCHTASKS for scripting and automation; use GUI for interactive management.

Can SCHTASKS create tasks on remote computers?

Yes. Use /S computer to specify the remote computer. For example: SCHTASKS /Create /S SERVER01 /TN "Backup" /TR "C:\backup.bat" /SC DAILY /ST 02:00. You need appropriate permissions on the remote computer.

How do I run a task as Administrator?

Use /RU with an Administrator account: SCHTASKS /Create /TN "AdminTask" /TR "script.bat" /SC DAILY /ST 03:00 /RU Administrator /RP password. Or use /RL HIGHEST for highest privileges.

Why does my scheduled task not run?

Check: (1) Task is enabled, (2) Next run time is correct, (3) Computer is on at scheduled time, (4) User account has valid password, (5) Script path is correct.

Can SCHTASKS run a batch file?

Yes. Use full path: SCHTASKS /Create /TN "MyBatch" /TR "C:\scripts\mybatch.bat" /SC DAILY /ST 01:00. Ensure the batch file uses absolute paths for any files it accesses.

Quick Reference Card

CommandPurposeExample Use Case
SCHTASKS /QueryList all tasksView scheduled tasks
SCHTASKS /Create /TN name /TR program /SC DAILY /ST 02:00Create daily taskSchedule backup
SCHTASKS /Run /TN nameRun task nowManual execution
SCHTASKS /Delete /TN name /FDelete taskRemove scheduled task
SCHTASKS /Create /TN name /TR program /SC ONLOGONRun at logonLogon script
SCHTASKS /Create /TN name /TR program /SC ONSTARTRun at startupStartup task

Try SCHTASKS Command Now

Practice task scheduling in our Windows Command Simulator. Explore TASKLIST for process management, RUNAS for running as different user, and the full Commands Reference for more Windows CMD utilities.

Summary

The SCHTASKS command provides full command-line control over the Windows Task Scheduler. Use /Create to schedule tasks with various triggers (daily, weekly, at logon, at startup), /Query to list tasks, /Run to execute immediately, and /Delete to remove tasks. SCHTASKS supports local and remote management, different user contexts, and scripted automation. Combine with TASKLIST to verify task execution and with RUNAS for elevated context. Follow best practices: use absolute paths in scheduled scripts, test before scheduling, and document task purpose. Master SCHTASKS for effective Windows task automation and maintenance scheduling.