Running AutoIt


Running AutoIt

AutoIt can be executed from the command line, or by double-clicking on its icon from the Windows Explorer.

>>> N.B.  The ONLY file that is necessary for AutoIt to run is "AutoIt.exe", putting this file in the path on any PC will allow you to run AutoIt scripts on that PC using the command line syntax below. <<<


Command Line Syntax

AutoIt is executed from the command line in the following ways (make sure AutoIt.exe is in your path, or you run the commands from the directory that AutoIt is installed):

AutoIt.exe /reveal

AutoIt.exe <filename of script file>

AutoIt.exe /c "ScriptCmd, ScriptParam"

Reveal Mode

When in "reveal" mode, the AutoIt window will stay topmost. As you click on other windows to make them active, AutoIt will display their window titles, the mouse coordinates relative to that window, and any other text on the window that may help to distinguish it from other windows of the same title. As with MS ScriptIt, not all text on a window can be "seen" - experiment!

Information on the AutoIt reveal screen can be highlighted with the mouse and copied to the clipboard with "CTRL-C", this can then be pasted into another program / text editor.


Script Mode

AutoIt will execute the script filename given on the command line. The file can have any extension (if you use the installation routine, .aut will be automatically registered. Right clicking on a .aut file will enable you to run or edit the script).


Single Command Mode

AutoIt will execute the script contained in quotes as a single command.  This is veyr useful for running AutoIt commands from other batch files or WSH/kixtart without having to provide a separate script file.  For example:

AutoIt.exe /c "WinWaitActive, Untitled - Notepad"


Using Command Line Parameters

Parameters can be passed to the AutoIt script from the command line when using the following syntax:

AutoIt.exe <filename of script file>  param1 param2 param3........param_nn

(Note: previous versions of AutoIt required /p to be used to indicate that command line parameters were present, this is no longer required or supported).

These parameters are usable from the script file as the ENV variables %1%, %2%, %3%, etc.  The variable %0% will also contain the number of parameters passed.

If a parameter needs to contain spaces, then enclose it in double quotes, e.g.:

AutoIt.exe testscript.aut "D:\A long pathname" var2

%1% would equal D:\A long pathname

%2% would equal var2