Example Code

Display and execute command lines from within a TestStand sequence file

Code and Documents


To display command line window from a TestStand Sequence file, use the Call Executable Step Type. The key is to use the cmd.exe located in path “C:\Windows\system32\cmd.exe” and use the command line options that are available to cmd.exe. In this example we will use the options “/c” and “/k”. The “/c” runs the command line and then terminates. The “/k” runs the command line and then returns to the command. This option is useful for debugging and testing the command line. For further information on command line options, open up a command line shell by typing into the command line: “help cmd”.

Enter the cmd.exe as shown below. Enter the option of the cmd.exe in the argument expression with the command. 


If the arguments are required for the command line, use the control “\” with the quote as shown below:


If the desired output from the command line is required in the TestStand report or a file depending on what option you select, go to into the Standard Output/Error Tab.  By selecting this option in TestStand, the output no longer will be displayed as a command line shell window. Instead you will see the information displayed in the TestStand report or in a file you specify. The results will also be available in theTestStand properties so that the properties can be accessed later on if required.


Likewise any scripting language like Perl or Python can be called from the Call Executable Step Type. It is recommended to use the “\” character for the arguments supplied to the scripting language call.


Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.