A batch file includes the commands to be executed by Command Prompt in Windows 10 (and older versions). I have already explained what a batch file is 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, let’s look at how to enable the ‘Run As Administrator’ option for a batch file in Windows. This simple trick will save your efforts of using the right-click to enable the ‘Run As Administrator’ command prompt every time.
How to Run a Batch File as Administrator in Windows 10?
We’ll be 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 batch files have existed for a long time. Follow the steps mentioned below.
1. Right-click on your batch file.
2. Click Create Shortcut
3. Right-click on the shortcut files and click on Properties.
4. In the Shortcuts tab, click on Advanced.
5. Check the ‘Run as Administrator’ checkbox.
6. Click OK to close the dialogue box.
7. 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 need access to 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.