In Windows 11 running batch files usually require running the batch with administrative privileges. If you want to configure a batch file to run as an administrator with a simple double-click, you can use a shortcut.
Batch files can be useful for automatically creating and running one or multiple commands in sequence to perform different tasks.
Some applications and file types usually include an option on the properties page to run as administrator, but that’s not the case for batch files. You have to launch the Command Prompt elevated to run the script or choose the option from the context menu, but these options add some unnecessary extra steps and complexity for non-technical users.
In this how-to guide, We will walk you through the steps to run batch files always elevated in Windows 11.
Here is how to run a batch file always as admin in Windows 11
How to create a batch file
- Open Start > search for Notepad > click the Open button.
- Type the following lines in the text file to create a batch file:
@ECHO OFF ECHO Hello World! This batch file always runs as admin. PAUSE
- Click the File menu > select the Save As option.
- Confirm a descriptive name for the batch using the “.bat” extension. For example, Test.bat
- Click the Save button.
- When done, you can proceed to configure the batch file to run as administrator with a double-click action.
How to configure batch file to run as admin
- Open File Explorer > click the New menu > select the Shortcut option.
- Click the Browse button > open the location and select the batch files > click the OK button.
- Click the Next button > confirm a name for the shortcut. For example, mybatch-admin.bat > click the Finish button.
- Right-click the shortcut and select the Properties option > click the Shortcut tab > click the Advanced button > check the Run as administrator option.
- Click the OK button > click the Apply button > click the OK button.
- When done, the next time you double-click the shortcut, the batch will run elevated on Command Prompt without needing extra steps.