Is there a command I can run, outside of the Windows GUI, to change a program so it will always run as administrator? I have several hundred .EXE files to change, and it's tedious to touch each one via File Explorer, so I would prefer to batch process them.
1 Answer
Yes, you can!
Generate a script which makes a .REG file to add new entries to the registry, one per each executable you need to adjust, to flip the bit and allow the app to Run As Administrator. Examples shown below are for an executable named "BAR.EXE" in "C:\Program Files (x86)\FOO\" and, believe me, the tilde and space before RUNASADMIN is essential.
For all users:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\Program Files (x86)\FOO\BAR.EXE"=
"~ RUNASADMIN"
Or, for one particular user:
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\Program Files (x86)\FOO\BAR.EXE"=
"~ RUNASADMIN"
-
-
-
-
More on the tilde prefix is found at superuser.com/questions/1095300/…. I agree, the tilde does make a difference, but still don't fully understand why. Jan 25, 2022 at 23:04