How to run a program as an administrator at startup on Windows 10?

207,033

Solution 1

This is a little old, but I was having the same problems, and none of the above was working. What I did was create a VBScript that ran at startup that opened said program.

  1. Right-click on the program, go to properties, then compatibility and check "Run as Administrator"

  2. Create the VBScript using a text editor (I use Notepad++)

Script:

Set WshShell = CreateObject("WScript.Shell" ) 
WshShell.Run """C:\Program Files (x86)\File\Program.exe""", 0 'Must quote command if it has spaces; must escape quotes
Set WshShell = Nothing

Note: that C:\Program Files (x86)\File\Program.exe is the full path to the program with extension. Also, make sure to save it as a .vbs

  1. Now place the VBScript in the startup folder:

    %AppData%\Microsoft\Windows\Start Menu\Programs\Startup

Or, alternatively access it by Win+Rshell:startupEnter

I used this instead of a batch file because I did not want that ugly command window showing up.

Solution 2

Create a Scheduled Task to trigger at log on.

In the Create Task dialog, select the following:

  1. General (tab), Run with highest privileges
  2. Triggers (tab), New (button), Begin the task, At log on

Solution 3

Well why don't you simply copy the shortcut of the program to the Startup folder and on its properties, enable the administrator permissions on the Compatibility tab?

Share:
207,033

Related videos on Youtube

ThN
Author by

ThN

Updated on September 18, 2022

Comments

  • ThN
    ThN almost 2 years

    We have a program that is having problem starting up on Windows 10. If the program is NOT run as administrator, it popups a "Access Denied" message right before it starts. If we run the program as an administrator, it does NOT popup any error message and loads normally. However, now the program won't run at STARTUP. So, we need to run our program as administrator and be able to automatically run the program at startup.

    Update: Even though my question and the duplicate question maybe the same but the answers provided for both questions did not solve my problem. Task Scheduler only starts my application or program as a background process. Thus, my program doesn't load. However, I do see my process in the task manager under background process. That's all.

    • fixer1234
      fixer1234 about 9 years
      @Moab: Can you confirm that the duplicate applies to Win 10?
    • ThN
      ThN about 9 years
      @Ramhound Yes it does, but task scheduler does not start my program normally but as a background process. That's not what I am looking for. Am I missing something?
    • ThN
      ThN about 9 years
      @fixer1234 if you are specifically talking about my question and the question marked as a duplicate, then no. My question is related to Windows 10 and the duplicate is related Windows 7.
    • ThN
      ThN about 9 years
      @Ramhound You are right, but one question is specifically asking for Windows 10 solution and the other one is for Windows 7 even though both solutions apply windows 10.
    • ThN
      ThN about 9 years
      @Ramhound Yes, you are right. You asked how my question and the duplicate question are different. I told you other than Windows versions, they are both the same. you can go ahead and mark my question as duplicate if you want.
    • fixer1234
      fixer1234 about 9 years
      @ThN: That was the purpose of my question. Solutions may or may not work across different Windows versions. I don't want to vote this as a duplicate if the solutions don't apply to Win 10. If they do apply, the specificity to Win 7 in the other question doesn't matter.
    • jeffm
      jeffm almost 9 years
      To maybe clarify what the questioner is trying to do, and why a background process is not OK, I have this problem on the release version of Win10: I want to run Dbgview at startup as admin so I can see the results of "Capture Global Win32 Output". If I put a shortcut in the Startup folder and check "run as administrator", it doesn't launch. On Win8.1, this works fine.
  • ThN
    ThN about 9 years
    I did follow your answer but it starts the program as a background process not as an application. As a result, nothing loads in the screen and the process is listed under background process in the Task Manager.
  • ThN
    ThN about 9 years
    The user that logins in when the system boots up is Admin with full privileges. I learned from other superuser question that Task Scheduler by default runs program only as NON-Admin-privileged. Thus, the program runs as background process even though "run with highest privileges" checkbox is checked.
  • ThN
    ThN about 9 years
    You are right. First, we have enabled Run with highest privilege checkbox in the compatibility section for the shortcut. Then, clicked on the icon, it still popped the error message. Then, we moved the shortcut into startup folder, it still raised the error message. We even tried Task Scheduler and still the same. I even tried batch file in the task scheduler like someone suggested. it the same. The only time it loads normally is when we right click on the actual executable file for my program and click on Run as an Administrator option in the popup menu. The only user is the admin in sys
  • Surya Teja Karra
    Surya Teja Karra about 9 years
    You know back in the days, XP had this "Run as" context menu with which I could run a program as another user had I got the authorization to do so. Maybe this program of yours needs the same thing :/
  • Ben Philipp
    Ben Philipp over 8 years
    You can use %appdata% instead of your personalized AppData\Roaming
  • ThN
    ThN over 8 years
    This is exactly what I end up doing, but I used Delphi to write a mini program which will call my program at startup. This mini program ran at startup. This workaround did the job.
  • THESorcerer
    THESorcerer almost 8 years
    this is actually an A LOT better answer than the previous, be cause you can program a daemon to start when computer start and no user is logged on, for example I need to start deluged at computer start even me or any1 else will log on on that computer (deluge is a torrent client, which in non classic mode will become client/server, therefore I don't need client started to have the server running), the only other solution but this is to have it started by another service (like cygwin's cron) or to make it a service (and to do that manually if the software makers didn't design it like this)
  • Paul Wasserman
    Paul Wasserman almost 8 years
    I found that that to invoke an elevated shortcut so that it ran as elevated, I had to let the script start cmd.exe with /c option to run the shortcut.
  • Codebeat
    Codebeat about 7 years
    It runs when I manually start it (as some kind of service, no windows or dialogs), it is a batch file, but does not run when I switch on the computer. Also tried it with the startup folder but doesn't work either. Why do they make this so difficult.
  • Anders
    Anders about 7 years
    @ThN You can try to add a small delay, 10-15 seconds, to the trigger. That fixed the "running in the background" for me. That was for a AutoHotkey script, don't know if it applies to your problem.
  • Kyle Delaney
    Kyle Delaney about 6 years
    To be clear, this still prompts the user to say if they want to run the program as administrator, right? This startup trick doesn't bypass that somehow, right?
  • HolyAvengerOne
    HolyAvengerOne almost 6 years
    There should be a built-in/native way of doing this.
  • HolyAvengerOne
    HolyAvengerOne almost 6 years
    This doesn't work.
  • HolyAvengerOne
    HolyAvengerOne almost 6 years
    This doesn't work.
  • Nicolas C.
    Nicolas C. almost 6 years
    At first it was not working for me either, but only because I had set the trigger to "At startup" which is wrong because my program is not a service, it's an application with a user interface. Instead, I had to set the trigger to "At logon" and select MY windows user. It worked right away after that!
  • Farid Cheraghi
    Farid Cheraghi over 5 years
    if it doesn't for you follow this tutorial: sevenforums.com/tutorials/…
  • marijnr
    marijnr over 5 years
    A problem I have with this is that I need it to use the shell:common startup folder. It needs to run as administrator for every user. When selecting "Run as Administrator" in the properties it only counts for the user that has performed this action. I need a solution that will work for every user that logs on the pc, without manually doing if for all the users.
  • niCk cAMel
    niCk cAMel about 5 years
    If I double click my program (a shortcut really) the UAC pops up and I can run it in elevated mode. However, the vbs script above doesn't start the shortcut in elevated mode, so I don't get a UAC popup and the program is started without admin priv
  • Nicolas
    Nicolas about 5 years
    This worked for me without specifying a delay! For me a batch file is started that is a wrapper script for starting the "barrier" ethernet KVM client. With this solution I am able to control UAC elevated windows via the remote system as well - great!
  • Wenfang Du
    Wenfang Du about 3 years
    @ThN Tried this answer with a GUI app, the GUI showed up on startup.
  • gd1
    gd1 almost 3 years
    This should be the accepted answer.
  • Valentino
    Valentino over 2 years
    @niCk cAMel in my case this script does prompt for UAC (unfortunately!) and does run the program elevated.
  • Valentino
    Valentino over 2 years
    @marijnr in compatibility settings you need to "change the settings for all users"
  • Admin
    Admin about 2 years
    Something I bumped into: you must run the Task Scheduler as admin to create a task