Schedule a Batch File to run automatically
To schedule a Batch File to run automatically in Windows 11 and Windows 10, you will have to follow these steps: Step 1: Create a batch file you wish to run and place it under a folder where you have enough permissions, for example, under C drive. Step 2: Click on Start and under search, type in Task, and click open Task Scheduler.
Step 3: Select Create Basic Task from the Action pane on the right of the window.
Step 4: Under Create Basic Task, type in the name you like and click Next.
Step 5: From the Trigger, select the option you like and click Next.
I chose Daily and clicked Next, which brought me to this screen.
Step 6: Then click on Start a Program and click Next.
Step 7: Now click on Browser and select the batch file you would like to run.
Step 8: Finally, click on Finish to create the Task. Now that we have created a Task, we must make sure it runs with the highest privilege. Since we have UAC settings, we have to make sure that it should not fail if it does not bypass the UAC settings when you run the file. So click on Task Scheduler Library.
Then double click on the Task you just created.
Step 8: Click on Run with Highest privilege, then click OK.
Congratulations! You have successfully created a Scheduled Task to automate a batch file. However, there can be drawbacks such as if the application you are trying to invoke needs a password. In that case, you cannot run it silently.
How do I run multiple batch files after one?
If you want to run batch files one after another, you can use the task scheduler and time them to run with the one-minute gap. The other way is to create a mother batch file, add a list of all bat files inside it, and let it execute one after the other.
How to add timeout or sleep in a Batch File?
You can add the following command along with other parameters. It will make sure user input is not considered, and there is no output for this.
How to run the batch files on Startup?
When setting up the task with the scheduler, you can run it as soon as you log into the PC. It can be delayed by a minute, but it will be executed. If you need to run it every few minutes, make sure to set it accordingly.