How to run a batch file always as admin on Windows 11

Run batch always as admin

Run batch always as admin(Image credit: Future)

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:

  1. Open Start.
  2. Search for Notepad, and click the top result to open the app.
  3. Type the following lines in the text file to create a batch file:


ECHO Hello World! This batch file always runs as admin. 


Windows 11 create batch file
(Image credit: Future)
  1. Click the File menu.
  2. Select the Save As option.
  3. Confirm a descriptive name for the batch using the ".bat" extension — for example, myBatch.bat.
Save batch file
(Image credit: Future)
  1. 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:

  1. Open File Explorer.
  2. Click the New menu and select the Shortcut option.
File Explorer create new shortcut
(Image credit: Future)
  1. Click the Browse button.
  2. Open the location and select the batch files.
  3. Click the OK button.
Shortcut file location
(Image credit: Future)
  1. Click the Next button.
  2. Confirm a name for the shortcut – for example, mybatch-admin.bat.
  3. Click the Finish button.
Shortcut settings
(Image credit: Future)
  1. Right-click the shortcut and select the Properties option.
Shortcut open properties
(Image credit: Future)
  1. Click the Shortcut tab.
  2. Click the Advanced button.
  3. Check the Run as administrator option.
Batch run as administrator
(Image credit: Future)
  1. Click the OK button.
  2. Click the Apply button.
  3. 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.