A batch file includes the commands to be executed by Command Prompt in Windows 10 (and older versions). I have already explained what is a batch file and how to create your own.
However, you’ll require administrator privileges for your batch file to run some commands in the Windows Command Prompt.
In this article, I am going to tell you how to enable ‘Run As Administrator’ option for a batch file in Windows. This simple trick will save your efforts of using the right-click to enable Run As Administrator command prompt every time.
How to run a batch file as Administrator in Windows 10?
Here, I am using Windows 10 to show the process of automatically running a batch file with Windows admin rights. However, the method works on older versions including Windows 7 and Windows 8/8.1 as the concept of batch files has existed for a long time.
Anyway, follow the steps mentioned below:
- Right-click on your batch file.
- Click Create Shortcut.
Right-click the shortcut file. Click Properties.
- In the Shortcuts tab, click Advanced.
- Check the Run As Administrator box.
- Click Ok to close the dialog box.
- Click on Apply to save the changes. Click Ok to close Properties.
Now, every time you run the shortcut file by double-clicking it, the Windows UAC message will be displayed. Click Ok to run as administrator in Windows. This is required as commands would require the access of more system-level components that are not available when you open CMD in user mode.
Did you find this helpful? Tell us in the comments below.