execute command

Execute a command-line command and return its output.
NameDescriptionTypeModifier
command

Command to be executed

StringNone
variable

Variable to receive the command output.

StringNone
timeout

Maximum wait time for the specified command to complete execution. If the timeout is reached, the running command is terminated (units: seconds).

Default Value: 300
StringNone
charset

Charset: (Optional) The encoding type of execute command’s output.

Value SetSHIFT-JIS,UTF-8
Execute a command-line command and return its output.
This action may be used within the following project items: test modules and user-defined actions.
Example - Case 1

Suppose you issue the dir command in your automation script to see the available files and directories in the
D:\Development directory.

Action lines
        
          	command	variable	time out	charset
execute command	dir D:\Development	var_output	400	UTF-8
        
    
Result

Instead of writing the dir output to the var_output variable, you can write the output to a file by using the redirect command output (>) operator.

Action lines
        
          	command	variable	time out	charset
execute command	dir D:\Development>D:\log.txt	var_output	400	UTF-8
        
    
Result
Effect
Example - Case 2

Suppose you may want to issue two commands in your automation script.

  • One command is to launch an application, such as Internet Explorer, and
  • the other is to see available files in a specified directory, such as D:\Development.

Additionally, these two commands must run asynchronously (without waiting for each command to finish).

        
          	command	variable	time out	charset
execute command	start "title" "C:\Program File (x86)\Internet Explore.exe"	var_output_ie	30	UTF-8
execute command	dir D:\Development	var_output_dir	30	UTF-8
        
    
Result
  • This built-in action is supported only on Windows test controllers, it is effective on Windows test platforms.

  • The execute command action can be invoked to execute any of the following:

    • Command line utilities.
    • Any application that can be invoked from the command line.
  • execute command works synchronously: that is, it causes test execution to wait for the specified command to finish before control is returned to the test. To execute commands asynchronously – that is, launch a command or application and continue with the test run without waiting – precede the contents of your command with the start command (see Example - Case 2).

    Tip:
    You can view the full syntax of the start command by typing start /? in the command prompt window.

  • If you want to write the command output to a file, rather than to the variable defined in the variable argument, use the redirect command output (>) operator in your command string. For example, to redirect a directory listing to the file dirlist.txt:

    Action lines
            
              	command	variable		
    execute command	dir > dirlist.txt	x		
            
        

    (Note that the output is fully directed to the file, and that the variable, while still a required argument, remains empty, or at its previous value.)

  • This action supports the <ignore> modifier. If the string <ignore> is present as the value of any of the arguments, or any argument contains an expression that evaluates to <ignore>, the action is skipped during execution.

Copyright © 2023 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1(800) 322-0333