I'm using Windows 8.1 x64 and I'd like to run a program with administrator privileges on user login.

I tried to make a shortcut of the program and ticked "run as administrator" in the properties of the shortcut or the program itself, and put the shortcut in C:\Users\MyUser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup or C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp , but ticking the box just made it invalid.

Then I edited the program by Resource Hacker to modify its manifest so that administrator privileges were required for this program. This also made shortcuts under start up directories invalid. So after this, I tried to add the program to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run but it didn't work, either.

How on earth can I run a program with administrator privileges on user login?

  • start a script that uses runas – Ramhound May 28 '15 at 13:16
  • @Ramhound You meant write a batch whose content is runas /env /user:domain\Administrator X:\path\to\the\program.exe and put it in the auto start up directory? – Frederick Zhang May 28 '15 at 13:23
  • You can use pretty much anything you want to run that command. It doesn't have to be a batch script. – Ramhound May 28 '15 at 13:28
  • 1
    @Ramhound But this command will prompt for the password which I don't want it to. – Frederick Zhang May 28 '15 at 13:30
  • You can use runas, and save the Administrator credentials, although that poses a security risk for obvious reasons. You are 100% this program required administrator permission to work properly? – Ramhound May 28 '15 at 13:43

The best way (and the only simple way if you not only want this to run as admin but also without an UAC prompt) to do this is by creating a scheduled task. There you can specify which user you want to run it under but also that it should "run with highest privileges". This is probably what you really want because the checkbox button "Run as administrator" does trigger a UAC prompt rather than really using an administrative user. If you also specify a trigger as "on user logon" it should have the same effect as using the startup or run key.

Alternatively you can use runas with the /savecred option to store the password of another user once and have it cached forever but it does not work around UAC afaik.

  • 1
    I tried task scheduler at first as well but it made the tray icon of the program missing. But I reviewed the configurations of the task just now and found a combo box named Configure for whose default value was Vista/2008. Then I switched it to Windows 8.1 and everything's ok now. Thanks. – Frederick Zhang May 28 '15 at 13:58
  1. Create file like appStart.cmd containing:

    start "" %1

  2. Second in registry you must add to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Key-Value pair


Value:"path-to-appStart.cmd" "path-to-myapp.exe"

This way on windows start up it will call your app from command prompt and it will ask for permission to run as administrator. After accepting command prompt close and you app runs with administrator privileges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.