Examples for Using STW.EXE

The command line supports the execution of any number of scripts in one execution of STW.EXE. The command line also supports input and output files and changing the project and run environments on a script-by-script basis.

Note: The -d, -u, and -p parameters are not included in most of these examples for readability.

General Help

STW -help

Single Project, All Scripts

STW -project ProjectName

Single Project, Single Script

STW -project ProjectName -script ScriptName

Single Script, Common Project

STW -s scriptname

The command line will use SilkTest as the DSN and Admin as the username with no password.

Script with a Space in the Name

STW -script "Script with spaces"

Specific Scripts in the Common project

STW -script Script1 -script Script2

All scripts in the Common project


Specific Scripts in Different Projects

In this example two different scripts are executed, since you can have the same script name in different projects, these refer to two unique scripts.

STW -project Project1 -script Script1 -project Project2 -script Script1

Specific Scripts in the Common and User Projects

Note: Once a project name is specified, all scripts that follow will be associated with that project.
STW -project Project1 -script Script1 -script Script2 -project Common -script Script1 -script Script2

Using an Input File

STW –file FileA.txt

Where the following is contained within FileA.txt:

# Execute my script
-script MyScript
# Change the environment and run again
-environment MyEnvironment
-script MyScript


STW -environment PlaybackEnvironment -s ScriptName

Multple Run environments

This example shows the same script being executed with a user defined run environment and the default run environment.

STW -environment MyRunEnv -script Script1 -environment -script Script1

The second use of -environment does not specify a name, it just resets the environment back to the default.


When executing a .NET script, visual test, or keyword-driven test that has parameters through the command line, you can specify the parameters of the asset by using the variable parameter. This overrides any global properties that are defined in the asset.

STW -script ScriptWithParameters -variable "var1=1234" "var2=Hello" "var3=True"

Verbose Mode

STW -u Admin -verbose -d MyDsn -s MyScript

The following is an example of output in verbose mode:

Copyright (c) 1996-2011, Micro Focus IP Development Limited. All Rights Reserved

DSN                   : STW-Scratch
Username              : admin
Password              :
Script(s)             : MyScript [Project3]

Append result         : False
Increment result      : False
Output file           : MyOutput.txt
Verbose Mode          : ON

Searching executable assets...

.NET Script ' MyScript' [Project3] found

Executing MyScript [Project3] ...

Script: MyScript [Project3], Status: Failed, Verifications: Total 5, Passed 0, Failed 5


STW -outputfile C:\Temp\MyFile.txt

Using a result directory

STW -s scriptname -resultdir C:\Temp\TestResults
STW -s scriptname -rd C:\Temp\TestResults