Start Batch File As Administrator



Save the file with the VBS file extension. Set app to run as admin Open File Explorer and navigate to the EXE of the app that you want to run as admin on startup. Right-click it, and select Properties from the context menu. Dear AJ, Your analysis is reasonable, if we want to execute the.bat file during boot, we need to use Administrator permission to run it. In my opinion, we could try to use Computer Startup Scripts to check result, Startup scripts are run under the Local System account, and they have the full rights that are associated with being able to run under the Local System account.

  • This Tutorial helps to How to Make a Batch file start always Run as Administrator start.bat - runas /savecred /user:administrator c: users wib.
  • Make a batch file in an editor and nameit.bat then create a shortcut to it. Nameit.bat - shortcut. Then right click on Nameit.bat - shortcut -Properties-Shortcut tab - Advanced and click Run as administrator. Execute it from the shortcut.

In the Windows operating system, a user account that is a member of the administrators group will not automatically have unrestricted full access to the operating system, thanks to the User Account Control system that has been implemented since Windows Vista. The purpose of the UAC restriction is to prevent malicious software from instantly making changes to any parts of the Windows operating system when it is launched. The User Account Control warning window will help to create an awareness to the user that a program from an unknown publisher wants to make changes to your computer.

As an example, the HOSTS file in Windows is used to map a hostname to an IP address and can be opened and viewed using a text editor such as Notepad. However, in order to save the changes made on the HOSTS file, Notepad must run as administrator or else you’ll get the error window saying “Access is denied.

An older program that was compiled during the Windows XP era will also face problems if it requires changes in restricted areas because it doesn’t create a UAC prompt to elevate privileges when run. To solve this problem, you can manually run the program as administrator and here we have 10 different ways to do it.

Start Batch File As Administrator1. Right Click on Program or Shortcut

One of the most common way to run a program with a UAC prompt to elevate privileges is by using your mouse to right click on the program file or shortcut and select “Run as administrator“.

2. Ctrl+Shift+Enter

For the more advanced user who uses the keyboard more than the mouse, a handy method to quickly run a program as administrator is by simultaneously pressing the Ctrl + Shift + Enter key when the program is selected at the Start menu. In fact, Ctrl + Shift + left click will also work.

Do take note that this method strictly works from the Start menu only but not on other areas such as the Desktop or Explorer.

3. Explorer Ribbon Menu

If you love to use the ribbon toolbar menu which was introduced in Microsoft Office 2007, you will find that there is a “Run as administrator” option from the Manage tab in Windows Explorer. Do note that this option is only available on executable files but not on program shortcuts.

You won’t find this in Windows 7 because the ribbon based Explorer has only been implemented since Windows 8.

4. Permanently running program as administrator

It would be quite annoying if you constantly need to manually run the program as administrator because there are times when you’ll forget to do that. Fortunately Microsoft provides a built-in method to permanently configure the program to run as administrator each time you run the program. You can either right click on the program exe file itself or the shortcut, select Properties, go to Compatibility tab, and tick the “Run this program as an administrator” checkbox. Finally click the OK button to apply the changes.

5. From Task Manager

Start Batch File As Administrator

The Task Manager tool in Windows is a useful utility that is commonly used to forcefully terminate a program and to see what process is running. Another very useful feature found in Task Manager that most users don’t know exists is the ability to run a program with administrative privileges without even getting the UAC prompt.

You can quickly launch Task Manager by simultaneously pressing Ctrl+Shift+Esc key, click on File menu, select New Task (Run…) and browse for the program. For Windows 8 and above, you’ll need to click on the More details button located at the bottom left, then only click on File menu bar, select “Run new task”, browse the program and make sure that the “Create this task with administrative privileges” checkbox is ticked.

6. RunAs

RunAs is a command line tool to execute program under a different user account that is available in Windows operating systems since XP. Surprisingly you can use RunAs to launch a program under the same user account and it will have elevated privileges without the UAC prompt. You will however need to enter the user account password and it cannot accept a blank password. The command is as follow:

runas /user:computernameusername 'C:pathtoprogram.exe'

7. PowerShell

PowerShell is a powerful automation tool that comes built in to the Windows operating system. It looks similar to command prompt except it can do so much more, thanks to the scripting language for complex operations. With a single command line below that can be used in batch files or in the Run window, you can launch a program as administrator with a UAC prompt using PowerShell.

powershell.exe -Command 'Start-Process 'C:pathtoprogram.exe' -Verb runAs'

If you’re running from PowerShell, then you’ll have to omit the command before the Start-Process. For example:

8. Task Scheduler trick

The Task Scheduler trick is a well known workaround method to permanently disable UAC for a specific program without disabling the whole User Account Control feature. It involves quite a few steps to get it to work which may be a bit challenging for beginners to accomplish. Fortunately there are a few third party programs that does the exact same thing but only involves a few clicks of a mouse button.

We’ve tested one of the program called ElevatedShortcut and it works in Windows 10 x64 without problems using the version that was built for Windows 8.

9. Elevate

The third party Elevate command line tool allows you to trigger a UAC elevation prompt for any programs that you specify which is very useful when working with batch files.

As you can see from the screenshot above, it triggers a UAC privilege elevation on Notepad and the user will still need to click on the Yes button to allow the program to run.

10. Vista UAC Maker

When you have a program that can work with or without admin access and you explicitly want to run it with elevated privileges every time, an official solution is to embed a manifest file into the executable file so that you get a UAC prompt each time you run it. You can use a command line Microsoft Manifest Tool to do it but a simpler way is to use Vista UAC Maker which acts as a front end GUI for mt.exe without the need to download the huge Win32 Development Tools. Vista UAC Maker also automatically generates a generic manifest file based on the given project description.

We’ve tested Vista UAC Maker under Windows 10 64-bit and it works perfectly. An important note is that the mt.exe tool requires .NET Framework 3.5 installed in order to work or else Vista UAC Maker will report that it failed to add manifest file to the specified executable file and to make sure that it is not running or being use by another program.

Download Vista UAC Maker

You might also like:

5 Ways to Show Administrator Account on Windows Logon Screen3 Ways to Change a Windows User Account Into an AdministratorBackdoor to Reset Administrator Password or Add New User in Windows 74 Ways to Find Out What Programs are Running in the Windows System Tray6 Ways to Trigger UAC Elevation from Command Line

Steve Sybesma1 year ago

I’m hoping to find a powershell script that can check the box on multiple EXE files in a folder which have the “Run this program as an administrator” checkbox. Otherwise, I have to do 98 files manually.

I would not know the command line, especially the correct word to use at the end.

ReplyStart Batch File As Administrator

Very good trick

Reply

Leave a Reply

This simple batch file will enable a PowerShell script file (*.ps1) to execute with Administrator permissions in Windows.

When preparing PowerShell code for others to use, it’s a lot easier to wrap it up as a PowerShell script file (*.ps1) and then execute it from a batch file (*.bat).

There are several good reasons for doing this:

  1. ‘Ordinary users’ are often confronted by PowerShell and baulk at using it (“it looks scary”).
  2. When a user double-clicks on a PowerShell script file (*.ps1) the default action is to open the file in Notepad (or similar) rather than executing it. This causes confusion (“it doesn’t work”).
  3. If the script relies on Administrator permissions to run properly, there is additional rigmarole for users to get this to work properly.
  4. Double-clicking on a file/icon is intuitive for 99% of the population.

I have a number of scripts which co-workers rely upon. Each script is saved as a *.ps1 file and activated via a *.bat file which in turn is linked-to on each users’ desktop via a shortcut (*.lnk). If I ever need to upgrade a script, I simply change the *.ps1 file and link to the new version using the *.bat. Because the desktop shortcuts for each user point to the *.bat, I never need to involve them when I update my work. Easy!

Some of my scripts require Administrator permissions to work. I have found the following batch file code to work well in activating PowerShell scripts with Administrator privileges:

Simply change the file path to point to the *.ps1 file.

Keeping it simple for users

As previously stated, I create shortcuts that point to *.bat files so that users can then place these on their desktops for ease-of-use.

When first creating shortcuts, there is a requirement to right-click on the shortcut, select “Properties”, go to the Shortcut tab and then click “Advanced…” to choose the “Run as Administrator” option.

Once that’s done, it’s ready to roll.

To run the script, a user just double-clicks on the shortcut. Microsoft Windows will still require users to respond to the User Account Control prompt, but the script will then execute seamlessly because the Batch file has instructed PowerShell to run with Administrator permissions.

And another thing…

Start Batch File As Administrator Windows 10

Should it be desired to hide the PowerShell window whilst it runs, start the *.bat file with the following code:

Note that the PowerShell window may still briefly appear when this code is used, but only momentarily.

Run Scheduled Task Batch File As Administrator

Have Your Say