Execute DOS Command

This tutorial explains how to execute a DOS command during a test scenario.  Use this when you want to prepare a test execution to delete result files or run a batch file. 

Using an Execute Command task, you can run accessible executable files.  We will use this task type in this example to run a DOS batch file:

  1. Create an Execute Command task. 
  2. Select the Configuration tab
  3. Set Command line path to C:\mybatch.bat
  4. Add any parameter in the Arguments test area, if needed

 

The Execute Command task can also be used to run commands directly – for instance, deleting a file.  This time, the cmd.exe executable needs to be called.

  1. Create an Execute Command task. 
  2. Select the Configuration tab
  3. Set Command line path to C:\Windows\System32\cmd.exe.  
  4. Set Arguments to /C del “C:\myFileToDelete.txt”.  Notice the “/C” before the actual command.  This is required by the command interpreter.