From iMacros
Jump to: navigation, search

Sets a variable to a value retrieved from the command line. The most common use for this command is to read user input from the command line at runtime. It can also be used to assign a default value to a variable in case no value is set by the command line.

Syntax iMacros Browser

CMDLINE variable_name default_value


  • variable_name
    Name of the variable that is to be set. Must be a variable that is changeable via the command line, i.e. one of the following:
  • default_value
    Default value variable is assigned if no value is given


Consider the following macro called macro1.iim:

CMDLINE !VAR1 abc.csv 
PROMPT Enter<SP>file<SP>name !VAR2 {{!VAR1}} 

Starting this macro from the command line with (see which iMacros editions support command line: Features Comparison):

imacros.exe -macro macro1 -var1 efg.csv 

would result in !VAR2 having the value efg.csv, while

imacros.exe -macro macro1 

would result in !VAR2 having the value abc.csv.

See Also