Run start as administrator but not the program it starts

  Kiến thức lập trình

My use-case necessitates setting an application to realtime priority in Windows. I do this by running start with /realtime to accomplish this. However, this requires administrator privileges to set, as only /high is allowed without.

The application I want to run must not run as administrator, but I am failing to accomplish dropping the privileges.

Can this be done from a shortcut? I tried runas but I can only get the runas command to get the priority and not the program it launches. Using set __COMPAT_LAYER=RUNASINVOKER does also not work, probably because the shell is launched as admin already to make the /realtime work? Flipping runas to prefix start just makes it only get high, as expected.

In summary, I am trying to create the following:

A shortcut that when executed will give the application the realtime priority but not run as administrator itself when it is launched.
It should not require running something post-start, I would like to accomplish this with something that I can trigger from a shortcut.

LEAVE A COMMENT