I'm not intereted in getting the whole script to run as administrator as that doesn't really assure me that the macros inside it will run the apps elevated.
I've gone to that route and it doesn't work:
here is my script
Code: Select all
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
try
{
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
Run, wbemtest
Sleep, 300
Send, {Enter}
SendRaw, root\securitycenter2
Send, {Enter}
Sleep, 300
Send, {i}
Sleep, 300
SendRaw, antivirusproduct
Send, {Enter}
Return
Thanks in advance.