Estimated Reading Time: 2 min
If you want to run a script automatically when Windows starts, executing a batch file (.bat) on startup is a great way to automate tasks. Whether you need to clear temp files, launch an application, or configure settings, here’s how you can execute a batch file on Windows startup.
Method 1: Add Batch File to Startup Folder (Easy Method)
One of the simplest ways to run a batch file at startup is by adding it to the Startup folder.
Steps:
- Create the Batch File
- Open Notepad and type your commands. Example:
@echo off echo Windows Startup Script Running!
- Save the file as StartupScript.bat.
- Open Notepad and type your commands. Example:
- Open the Startup Folder
- Press
Win + R
, type shell:startup, and hit Enter.
- Press
- Move the Batch File to Startup Folder
- Copy and paste your StartupScript.bat file into the Startup folder.
Now, your batch file will automatically execute every time Windows boots.

Method 2: Run the Batch File Using Task Scheduler (More Reliable)
If the Startup folder method doesn’t work due to permissions or security restrictions, use Task Scheduler.
Steps:
- Open Task Scheduler
- Press
Win + R
, type taskschd.msc, and press Enter.
- Press
- Create a New Task
- Click Create Basic Task on the right panel.
- Name it “Run Batch File on Startup” and click Next.
- Select “When the computer starts” and click Next.
- Set the Action to Start a Program
- Choose “Start a Program” and click Next.
- Click Browse and select the batch file (StartupScript.bat).
- Run the Task with Administrative Privileges
- Under the General tab, check “Run with highest privileges”.
- Finish and Save
- Click OK to finalize the task.
Now, the batch file will execute automatically at startup with admin rights.
Which Method Should You Use?
✅ Method 1 (Startup Folder): Best for simple scripts and personal use.
✅ Method 2 (Task Scheduler): More reliable, works even if the user account has restrictions.
By following these methods, you can automate tasks effortlessly in Windows!