Gemstone Common Library
Show/Hide TOC

# CommandExecute(String, String, Int32) Method

Executes a command line operation and returns its standard output and exit code or throws an exception with the standard error.

## Definition

Namespace: Gemstone.Console
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.164 -- Release Build+6bbd7ea5ff4ad8917f12d693358b77d083ee278e
C#
View Source Request Example

    public static CommandResponse Execute(
    	string fileName,
    	string? arguments = null,
    	int timeout = -1
    )

VB
View Source Request Example

    Public Shared Function Execute (
    	fileName As String,
    	Optional arguments As String = Nothing,
    	Optional timeout As Integer = -1
    ) As CommandResponse

C++
View Source Request Example

    public:
    static CommandResponse^ Execute(
    	String^ fileName,
    	String^ arguments = nullptr,
    	int timeout = -1
    )

JavaScript
View Source Request Example

    Gemstone.Console.Command.Execute = function(fileName, arguments, timeout);

#### Parameters

fileName String
  Command line file name to execute.
arguments String (Optional)
  Command line arguments to use, if any.
timeout Int32 (Optional)
  Timeout, in milliseconds, to wait for command line operation to complete.

#### Return Value

CommandResponse
A CommandResponse containing the standard output received from command and the exit code.

## Exceptions

CommandException | Exception occurs when executed command process reports standard error output or process times-out.

## See Also

#### Reference

Command Class
Execute Overload
Gemstone.Console Namespace