Running a command as a scheduled task
How to run a command or script as a scheduled task in Windows.
If you need to run a command or script automatically at a scheduled time in Windows, you can use the built-in Task Scheduler. Here’s a quick guide:
- Open Task Scheduler from the Start menu.
- Click Create Basic Task.
- Give your task a name and description.
- Choose the trigger (e.g., daily, weekly, at startup).
- For the action, select Start a program.
- Enter the path to your script or command (e.g.,
C:\Scripts\my_script.bat
). - Complete the wizard and confirm your settings.
You can also use the schtasks
command-line tool to create tasks programmatically:
schtasks /create /tn "MyTask" /tr "C:\Scripts\my_script.bat" /sc daily /st 09:00
This will run my_script.bat
every day at 9:00 AM.
Posted in: Windows, Automation / Tagged: Windows, Scheduled Tasks, Automation, Command Line
Note: This post was salvaged from my old blog at netawakening.azurewebsites.net via the Wayback Machine.
This post is licensed under CC BY 4.0 by the author.