TestComplete Tip: How to execute an OS command programatically

  September 25, 2006

Sometimes it's necessary to execute an OS command via the system Run dialog. This dialog can be opened by pressing the Start button and then selecting the 'Run...' item from the Start menu. However, simulating these actions as clicks and keystrokes in a script is not very fast or convenient. I recommend using the following routine that executes commands programmatically.

If the command fails for some reason, an error will be generated and its number and description will be posted to the log. Note that not all errors have a description.