0

I want to start an application (x86 x64) with automatic system start (win 7 or 10 x86 x64), but when it starts it must have administrative privileges. What registry key should I use:

"HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run"

or

"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

or both at the same time (since the application is x86 and x64), or neither and I must use a different one

PD: According to microsoft: "The WOW6432Node registry key is typically used for 32-bit applications on 64-bit machines. If they are present on x86 machines, they do not cause any problems as they are not used". But this explanation does not answer my question

PD: According HERE "use %windir%\SysWOW64\reg.exe to manipulate 32-bit registry entries and %windir%\System32\reg.exe to manipulate 64-bit registry entries". But this explanation does not answer my question

2 Answers 2

1

The CMD shell, START and RUNAS commands have no built-in options to elevate or run individual commands 'As Admin' (elevated).

An executable set to always run as Admin by right-clicking it, selecting Properties > Compatibility, tick "Run this program as an administrator" and OK.

A batch file (.bat) cannot be set this way, so you need to create a shortcut to it by right-click, then Send to > Desktop (create shortcut). You may then right-click the shortcut, select Properties > Shortcut > Advanced, set "Run as administrator" and OK.

The executable or shortcut can then be added to the Run registry key.

1
  • Brilliant! I had no idea that you could set an executable to always run as admin, no matter how it's invoked, and this is an absolute godsend! Many thanks :-)
    – Kenny83
    Aug 26, 2022 at 6:12
1

Running programs elevated via Run keys or the Startup folder is not possible since Windows Vista.

The alternate is to use Task Scheduler and configure the program to start (run with highest privileges) "At logon".

4
  • Not entirely true. Using the HKLM Run key will launch the process as SYSTEM user, which is elevated, but non-interactive. To run a program as administrator AND allow interaction, you can create a task using task scheduler.
    – LPChip
    May 29, 2021 at 16:50
  • @LPChip: I don't think the startup program under HKLM runs as SYSTEM. I even tested it with a script (non-interactive). Do you have a reference/link?
    – w32sh
    May 29, 2021 at 17:14
  • Ah, I know what I'm confusing here. HKLM runs for all users. I was thinking of the Group Policy Startup scripts. They run as system, as they run before the user is logged in.
    – LPChip
    May 29, 2021 at 17:27
  • Rather than ticking the "Run with highest privileges" box, I specified SYSTEM for the task's user account. Not sure if it matters, but I was running taskschd.msc while elevated when creating the task. Works like a charm, it runs the specified command with elevation at user logon, without any UAC prompts. Jan 15, 2022 at 4:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .