Execute Method (SystemFunctions)

Action

Executes the specified command on the machine on which the Open Agent is hosted.

Syntax

C#

eReturn = Execute (commandLine [, executionMode]);

VB

eReturn = Execute (commandLine [, executionMode])
Variable Description
eReturn The return value of the command. ExecutionResult.
commandLine The command to execute. String.
executionMode Optional: An option specified with one of the constants defined for the ExecutionMode enumerated data type. Defaults to WaitUntilFinished if not specified. ExecutionMode.

Example 1

This example creates a new directory and waits until the directory is created before continuing the script execution:
// C# code
Agent.SystemFunctions.Execute("mkdir c:\mf_community1");
'VB code
Agent.SystemFunctions.Execute("mkdir c:\mf_community1")

Example 2

This example starts calc.exe and continues executing the script while calc.exe is running:
// C# code
Agent.SystemFunctions.Execute("calc.exe", SilkTest.Ntf.SystemFunctions.ExecutionMode.ContinueRunning);
'VB code
Agent.SystemFunctions.Execute("calc.exe", SilkTest.Ntf.SystemFunctions.ExecutionMode.ContinueRunning)