HOWTO Permanently Run as Administrator in Win10 - arcdev/engram404 GitHub Wiki
originally posted 2017-11-26 at https://engram404.net/howto-permanently-run-as-administrator-in-win10/
Sometimes an app just doesn't really run right without Elevated Permissions, or you nearly always need to Run as Administrator.
If you're just launching the app from a shortcut, the simplest thing to do is modify the shortcut's properties:
But what if you have a file association (say… a SLN file associated with Visual Studio) and you're not always starting the app with the shortcut?
Well, in Windows 7, this was easy. You could simply adjust the properties on the EXE itself. This still works for some apps, but not others…and I haven't figured out the difference. If you've got the option on the EXE properties, it looks like this:
Of course, there are others, like the Visual Studio EXE (devenv.exe) that don't have this option.
Where does that leave us?
Well, the prescribed way of resolving this is to use the Program Compatibility Troubleshooter (or Assistant). But, as with nearly everything in Windows 10, they've made this into a lengthy process.
Instead, I found that you can handle this for many (most?) app with a simple registry entry.
You can set this either for just the Current User in the HKCU (HKEY_CURRENT_USER) hive, or for all users in the HKLM (HKEY_LOCAL_MACHINE) hive. For our example, we'll focus on just the Current User.
Here's a handle little PowerShell script. Just modify the $filePath, run it, and you're done.
$regPath = 'HKCU:SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers'
$filePath = "C:\tools\procexp.exe"
New-ItemProperty -Path $regPath -Name $filePath -PropertyType String -Value '^ RUNASADMIN'
(You can also find the snippet here).