是,域用户是user权限,有些软件或安装软件需要管理员权限。在dos下用runas最稳定。手动操作没问题。所以想模拟手工操作达到自动化。Local $UserName = "red" ;管理员名称
Local $PassWord = "redapple" ;管理员密码
Send("#r")
WinWaitActive("[CLASS:#32770]")
Local $flag = ControlSend("", "", "[CLASS:Edit; INSTANCE:1]", "cmd.exe" & "{Enter}")
Sleep(2300)
Local $sdoscommand = "runas /user:" & $UserName & " " & "cmd.exe"
WinActivate("[CLASS:CASCADIA_HOSTING_WINDOW_CLASS]")
Local $flag = ControlSend("[CLASS:CASCADIA_HOSTING_WINDOW_CLASS]", "", "", $sdoscommand & "{Enter}")
Sleep(1300)
ControlSend("[CLASS:CASCADIA_HOSTING_WINDOW_CLASS]", "", "", $PassWord & "{Enter}")
Sleep(300)
WinClose("[CLASS:CASCADIA_HOSTING_WINDOW_CLASS]")
Sleep(2300)
If WinExists("[CLASS:ConsoleWindowClass]") Then ControlSend("[CLASS:ConsoleWindowClass]", "", "", "D:\soft\PureCodec20230222.exe" & "{Enter}")
If WinExists("[CLASS:CASCADIA_HOSTING_WINDOW_CLASS]") Then ControlSend("[CLASS:CASCADIA_HOSTING_WINDOW_CLASS]", "", "", "D:\soft\PureCodec20230222.exe" & "{Enter}")
Sleep(2300)
WinClose("[CLASS:CASCADIA_HOSTING_WINDOW_CLASS]")
WinClose("[CLASS:ConsoleWindowClass]")
|