RUN_COMMAND

The RUN_COMMAND command allows you to execute any program on Windows with a set of parameters. The following parameters are supported by the command.

This command may be disabled from within the application interface in the Configuration dialog in the General Advanced section for security. If it has been disabled, any scripts with RUN_COMMAND will not execute the command and will produce an error. It can not be re-enabled via scripting.

  • COMMAND_LINE - full command line to run. If you need to use quotation marks in your command line, instead use apostrophes (i.e. ' rather than ") and they will be converted to quotes prior to running the command. Note to run a DOS shell command like 'mkdir', you will need to run it via cmd.exe, like COMMAND_LINE="cmd /C mkdir 'C:\temp\export test\new folder'" (note use of apostrophes for quotes).
  • PRESERVE_APOSTROPHES - indicates whether or not apostrophes will be converted to double-quotes in the command string. Use PRESERVE_APOSTROPHES=YES to keep the apostrophes. The default is NO, so if you don't specify this parameter, the apostrophes in the command string will be converted to double-quote symbols.
  • WAIT_FOR_COMPLETE - specifies whether or not the script should wait for your command line run to complete prior to continuing. The default is to wait for the command to complete (i.e. WAIT_FOR_COMPLETE=YES). If you just want the command line to run and then immediately let the script continue processing, use WAIT_FOR_COMPLETE=NO.
  • CAPTURE_RESULT - specifies the name of a variable where the result of the program will be stored. The variable does not have to be created via a DEFINE_VAR command before it is used here, although it is OK if it is. The result will only be stored if RUN_COMMAND waits for the program to complete (see WAIT_FOR_COMPLETE).
  • HIDE_WINDOW - specifies that any window launched by the command (like a command window) will initially be hidden. Add HIDE_WINDOW=YES to hide the window.

SAMPLES

Here is a sample that runs another instance of Global Mapper and loads a file:

RUN_COMMAND COMMAND_LINE="'c:\program files (x86)\GlobalMapper16\global_mapper.exe' 'c:\temp\export test\blue_springs.opt'" WAIT_FOR_COMPLETE=NO

Here is a sample that calls another .exe and stores the return code of the .exe to the variable RESULT:

RUN_COMMAND COMMAND_LINE="'c:\temp\test1.exe'" CAPTURE_RESULT="RESULT"