How do I elevate privileges of a process running on Windows?

Viewed 45

How to request admin rights from a user in golang?

In principle, I know that on the exe program you can check the Run as administrator checkbox in the properties. But I need an example in code form. So that they can be requested not at the start of the program. And somewhere at the end.

1 Answers

It's not possible for an already-running process to be elevated (or, as far as I know, restricted further). It can be faked by having an already-running process spawn a new elevated process and then communicate with that new process but that only works if you control the code of the program that you wish to have run in a restricted context most o the time but perform some elevated operations.

Related