How to run a batch file always as admin on Windows 11
Do you have a batch file that must run as admin? Use this trick to save some extra steps on Windows 11.
On Windows 11, batch files can be useful for automatically creating and running one or multiple commands in sequence to perform different tasks. The only caveat is that some actions usually require running the batch with administrative privileges.
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 can launch Command Prompt elevated to run the script or choose the option from the context menu, but these options can add some unnecessary extra steps and complexity for non-technical users.
If you want to configure a batch file to run as an administrator with a simple double-click, you can use a shortcut to do the trick.
In this how-to guide, I'll walk you through the steps to run batch files always elevated on Windows 11.
How to run a batch always as admin on Windows 11
If you need to run a batch file as an administrator with just a double-click, you'll need to create a shortcut. This is because the properties page of this file format doesn't include such an option.
Create batch file on Windows 11
To create a PowerShell script with Notepad, use these steps:
Get the Windows Central Newsletter
All the latest news, reviews, and guides for Windows and Xbox diehards.
- Open Start.
- Search for Notepad, and click the top result to open the app.
- 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, myBatch.bat.
- Click the Save button.
Once you complete the steps, you can proceed to configure the batch file to run as administrator with a double-click action. If you're getting started with batch files, you can check this guide to learn more about how to create and run these types of files.
Configure batch file to run as admin
To run a batch file always as an administrator on Windows 11, use these steps:
- Open File Explorer.
- Click the New menu and 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.
After you complete the steps, the next time you double-click the shortcut, the batch will run elevated on Command Prompt without needing extra steps.
The guide focuses on Windows 11, but you can also refer to these steps for previous versions of the operating system, including Windows 10, 8.1, and 7.
More resources
For more helpful articles, coverage, and answers to common questions about Windows 10 and Windows 11, visit the following resources:
Mauro Huculak has been a Windows How-To Expert contributor for WindowsCentral.com for nearly a decade and has over 15 years of experience writing comprehensive guides. He also has an IT background and has achieved different professional certifications from Microsoft, Cisco, VMware, and CompTIA. He has been recognized as a Microsoft MVP for many years.