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

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.

How to run a batch file always as admin in Windows 11 featured

Here is how to run a batch file always as admin in Windows 11

How to create a batch file

  1. Open Start > search for Notepad > click the Open button.How to run a batch file always as admin in Windows 11 1
  2. 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

    How to run a batch file always as admin in Windows 11 2

  3. Click the File menu > select the Save As option.How to run a batch file always as admin in Windows 11 3
  4. Confirm a descriptive name for the batch using the “.bat” extension. For example, Test.batHow to run a batch file always as admin in Windows 11 4
  5. Click the Save button.
  6. 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

  1. Open File Explorer > click the New menu > select the Shortcut option.How to run a batch file always as admin in Windows 11 5
  2. Click the Browse button > open the location and select the batch files > click the OK button.How to run a batch file always as admin in Windows 11 6
  3. Click the Next button > confirm a name for the shortcut. For example, mybatch-admin.bat > click the Finish button.How to run a batch file always as admin in Windows 11 7
  4. Right-click the shortcut and select the Properties option > click the Shortcut tab > click the Advanced button > check the Run as administrator option.How to run a batch file always as admin in Windows 11 8
  5. Click the OK button > click the Apply button > click the OK button.
  6. When done, the next time you double-click the shortcut, the batch will run elevated on Command Prompt without needing extra steps.

Read more:

About the Author

I'm a passionate tech enthusiast here to break down the latest trends, gadgets, and software. Whether you're a seasoned programmer or just curious about the digital world, I aim to deliver insightful articles that are both informative and engaging.

Leave a comment