本文主要是介绍使用管理员权限运行AutoHotkey的Script,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在Script的最前面加上这些语句:
Loop, %0% ; For each parameter:
{
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
params .= A_Space . param
}
ShellExecute := A_IsUnicode ? "shell32\ShellExecute":"shell32\ShellExecuteA"
if not A_IsAdmin
{
If A_IsCompiled
DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_ScriptFullPath, str, params , str, A_WorkingDir, int, 1)
Else
DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_AhkPath, str, """" . A_ScriptFullPath . """" . A_Space . params, str, A_WorkingDir, int, 1)
ExitApp
}
这篇关于使用管理员权限运行AutoHotkey的Script的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!