Home > Running a Script > Running a Script from the Command Line

Running a Script from the Command Line

This article describes how to run WinTask Scripts from a command line.

The command line is as follows:
"C:\Program Files (x86)\WinTask\Bin\TASKEXEC.EXE"   "C:\Program Files (x86)\WinTask\Scripts\<my_script>.ROB" ["<param1>" "<param2>"]

Switches and System Variables can be used in the command line, with this syntax:
"C:\Program Files (x86)\WinTask\Bin\TASKEXEC.EXE" --s --#IgnoreErrors=1 --#ExecTimeout=10 "C:\Program Files (x86)\WinTask\Scripts\<my_script>.ROB" ["<param1>" "<param2>"]

The switch --s means that the command line will return no error message if the execution of the .ROB cannot be started for any reason (silent mode); in case of an error for starting the execution, the process TaskExec.exe will return a non-zero error code.
You can pass system variable values; in the example above, #IgnoreErrors will be set to 1 and #ExecTimeout to 10 during script execution. If a system variable is set to a new value within the script, it's the new value which is taken into account.

TaskExec exit codes

TaskExec can return an exit code through the use of End function:

Sample batch calling my_script.rob
"c:\program files (x86)\wintask\bin\taskexec.exe"   "c:\wttest\my_script.rob"
errorlevel  %errorlevel%

See also

Running a Script from the Editor
Running a Script by Clicking a Desktop Icon
Running a Script by Pressing a Key
Handling Errors & Logging
Running a Script in Debug Mode