0

I added a string value in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, called MyAppName, with its value of its full path, say C:\Temp\MyAppName.exe.

I restarted, but it wasn't started, and I have no idea why. When I use the same path from command-line it starts (after receiving the elevation approval).

As implied, this app asks for elevation when it starts, FWIW...

I use Win8.1 64 bit

Tar
  • 8,529
  • 9
  • 56
  • 127
  • 2
    "after receiving the elevation approval" is the problem. You cannot launch an app that requires UAC elevation from the Run registry key. The user has no idea where the prompt comes from and what he might be approving. So it is simply disabled. – Hans Passant Mar 23 '15 at 13:40
  • possible duplicate of [Program needing elevation in Startup registry key (windows 7)](http://stackoverflow.com/questions/2293609/program-needing-elevation-in-startup-registry-key-windows-7) – Raymond Chen Mar 23 '15 at 16:09

1 Answers1

2

You need to create a non-UAC wrapper. This can show a simple dialog (e.g. "Start Acme.Inc Widgelator? Yes/No"). You should show the UAC shield on the Yes button.

The usual case for such a UAC-at-startup scenario is an version check. You should do the version check without admin rights and only prompt for elevation if an update is in fact available.

MSalters
  • 173,980
  • 10
  • 155
  • 350