1. Home
  2. Windows

How To Auto-run Batch Files As Administrator On Windows 10

Scripts are a great tool for doing small, redundant tasks that you won’t normally find apps for. If you know how to write a script, you can get most things done without ever having to rely on an app. If you can’t write scripts, you can usually find ones online that others have written and use them to fit your needs. With scripts, Windows 10 tends to be careful as they can be dangerous and some commands in a script require admin rights to execute on your system which prevents them from working even if they can run. Here’s how you can auto-run batch files as an administrator on Windows 10.

Batch Files As Administrator

To auto-run a batch file as administrator, you need to first create the batch file, and then create a shortcut for it. To create a shortcut, right-click the file, and select Send to<Desktop(Create shortcut). This will place the shortcut on your desktop but you can move it anywhere you like later.

Once the shortcut has been created, go to your Desktop and right-click it. Select Properties from the context menu. On the Shortcut tab, you will see an Advanced button at the bottom. Click it.

This will open another, smaller window with just one option that you can enable; Run as administrator. Select this option, click Ok, and then Apply. Move the shortcut to wherever you want to run it. Set it as the action for a scheduled task or move the shortcut to your startup folder and have it run on boot.

There are some constraints with this setup. For one, the batch file will run however, you will see the UAC prompt asking you to confirm that the batch file can run with admin rights. If you’re not logged in as the admin user, you’re going to have to enter the admin username and password. There’s no escaping this part. Once you authenticate with the admin account, the batch file will run as it’s written.

If at any point a command in the batch file requires that you enter the admin password to confirm the command can run, you will have to enter the password again. The batch file is running with administrator rights however, it doesn’t give blanket permission for all commands to run without confirming an action. Likewise, if at any point you need to confirm a command by tapping the Y key, you will still need to do that.

You can also auto-run PowerShell scripts but the trick to it is different.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.