TBH I don't really think that's possible, because if it were it would be a huge security hole,because it would allow user mode applications to interact with COM.Objects
of privileged processes.
https://docs.microsoft.com/en-us/window ... ellexecute
VB scripts use https://ss64.com/vb/shellexecute.html
to elevate,but Shell.Execute()
in that link doesn't return an object,meaning it's more like a RunAs command,which simply won't do as piping to a file'less' script as in ExecScript()
interacts with the created process instead of simply running it.
Code: Select all
Performs a specified operation on a specified file.
Run a script or application in the Windows Shell.
.ShellExecute "application", "parameters", "dir", "verb", window
.ShellExecute 'some program.exe', '"some parameters with spaces"', , "runas", 1
application The file to execute (required)
parameters Arguments for the executable
dir Working directory
verb The operation to execute (runas/open/edit/print)
window View mode application window (normal=1, hide=0, 2=Min, 3=max, 4=restore, 5=current, 7=min/inactive, 10=default)
The runas verb is undocumented but can be used to elevate permissions.
; ExecScript: Executes the given code as a new AutoHotkey process.
shell := ComObjCreate("Shell.Application")
exec := shell.ShellExecute("C:\Program Files\AutoHotkey\AutoHotkey.exe", "/ErrorStdOut *",,"runas")
;you can't interact with created process so,no point from here on...