Is there any way to elevate a new process or thread to administrator in Go?
It seems like ShellExecute()
isn't available in Go and it isn't possible to elevate with CreateProcess()
. I have no idea what else could be possible.
You can try and check the project w32: it has a shell32.go ShellExecute()
that could be useful.
w32
is a wrapper of windows apis for the Go Programming Language.It wraps win32 apis to "Go style" to make them easier to use.
CreateProcess()
does not support running elevated processes, but there is a third-party CreateProcessElevated()
function in the following article that can:
Vista UAC: The Definitive Guide
It also provides elevation versions of several other functions, including CreateProcessAsUserElevated()
and ShellExecuteElevated()
.