Keyword Reference


#RequireAdmin

Specifies that the current script requires full administrator rights to run.

#RequireAdmin

Remarks

This function was primarily aimed at allowing AutoIt scripts to work correctly with Windows User Account Control (UAC).

For more details see AutoIt on Windows Vista.

As this function launches a new elevated process, the return values from some functions may not be captured by the original. However, when a script is run from SciTE4AutoIt3 returns such as ConsoleWrite() should be displayed. If the system does not have an elevation mechanism (e.g. UAC disabled) any new process will run under the same user as the original.

Related

IsAdmin

Example

#include <MsgBoxConstants.au3>

#RequireAdmin
ConsoleWrite("! TEST1" & @CRLF)
ConsoleWrite("+ TEST1" & @CRLF)
ConsoleWrite("- TEST1" & @CRLF)
ConsoleWrite("> TEST1" & @CRLF)

If IsAdmin() Then MsgBox($MB_SYSTEMMODAL, "", "The script is running with admin rights.")