/* ,---, ,--, ,--.' | .--. ,--, ,--.'| .--.--. : : : .--,`| ,'_ /| : : ' / / ' : | |,--. ,--.--. | |. .--. | | : | ' | | : /`./ | : ' | / \ '--`_ ,'_ /| : . | ' | | | : ;_ | | /' :.--. .-. | ,--,'|| ' | | . . | | : \ \ `.' : | | | \__\/: . . | | '| | ' | | | ' : |__ `----. \ | ' | : ," .--.; | : | |: | : ; ; | | | '.'| / /`--' / : :_:,'/ / ,. | __| : '' : `--' \; : ; '--'. /| | ,' ; : .' \.'__/\_: |: , .-./| , / `--'---' `--'' | , .-./| : : `--`----' ---`-' `--`---' `---`--' ------------------------------------------------------------------ URL: http://www.autohotkey.com/forum/viewtopic.php?t=50448 ------------------------------------------------------------------ */ RunAsAdmin() { global Loop, %0% ; For each parameter: params .= A_Space . %A_Index% local ShellExecute ShellExecute := A_IsUnicode ? "shell32\ShellExecute":"shell32\ShellExecuteA" if not A_IsAdmin { A_IsCompiled ? DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_ScriptFullPath, str, params , str, A_WorkingDir, int, 1) : DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_AhkPath, str, """" . A_ScriptFullPath . """" . A_Space . params, str, A_WorkingDir, int, 1) ExitApp } }