Dir =  "",
Skip = 0,
Input =  "",
Stream =  "")

Retrieve and be notified about output from the console programs.


CmdCommand to execute.
DirWorking Directory, optional.
SkipDecimal, number of lines to be omitted from the start and the end of the command output.  For instance 3.5, means that first 3 and last 5 lines will be omitted.
InputProgram input (stdin).
StreamIf set to TRUE it will create a console window and display output line-by-line, in addition to returning the result as a whole.  If string, name of the function to be called as output updates (stream handler).  The function accepts one argument.


After the function finishes, ErrorLevel will be set to programs exit code.  You can’t use function names for stream handler which consist only of numbers.  To see Unicode characters (AHKL required), use cmd.exe /u option.  Not all command line programs support Unicode output (for instance sort.exe)


sOutput := Run("ping.exe localhost")                            ;just grab the output
sOutput := Run("ping.exe localhost", "", 0, "", "OnOutput")     ;with stream handler
sOutput := Run("cmd.exe /c dir /a /o", A_WinDir)                ;with working dir
sOutput := Run("sort.exe", "", 0, "abc`r`nefg`r`nhijk`r`n0123" )    ;with stdin input
if !ErrorLevel
    msgbox Program failed with exit code %ErrorLevel%

        OutputDebug %s%