# Command Line

A command-line interface (CLI) is a means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text (command lines). Operating system (OS) command line interfaces are usually distinct programs supplied with the operating system.

The **CommandLine** function allows applications to use a Windows command line interface to run commands. Use this function when you want to do some work in a Windows command line interface.

***

## Properties

### Command

The command to execute. This can be anything you can execute in the command line interface on Windows. The full file path must be included in the command when executing a file.

### Working Directory

The working directory *inside* the process started by the command.

### User Name

The user name to use when starting the process. User name must be specified in the format user\@domain.

### Password

The user password to use when starting the process.

### Wait for Return

If selected, the command prompt will be integrated into the process flow in a synchronous fashion and any return values from the command prompt can be used further down in the process.

If not selected, the command prompt will be started, but the process will continue straight away and not wait for the completion of that prompt ("fire and forget").

***

### Wait for Return Properties

#### Output Encoding

At runtime, this property will set the *StandardOutputEncoding* and *StandardErrorEncoding* properties.

Available values:

* Default
* ASCII
* UTF7
* UTF8
* Unicode

If Default is selected, the encoding values mentioned above are not set (and will retain their default values of null).

#### Timeout

The timeout value (in milliseconds) for the command prompt. It defines the time the Function's processing will wait for the command prompt to finish and provide a return value.

A value of 0 indicates an infinite timeout.

#### Kill on Timeout

This only applies if *Wait for Return* is selected and a valid *Timeout* value is specified.

When selected, the instantiated command prompt will be closed by the process when the timeout occurs.

When not selected, the command prompt will be ignored on timeout and the process will continue.

***

## Definition Variables

{% hint style="info" %}
Note: Definition variables are only available when the *Wait for Return* property is selected.
{% endhint %}

### Exit Code

The exit code of the command that was executed.

### Has Timed Out

Value to indicate whether the command has timed out while executing.

### Output

The output of the command that was executed.

## Links

* [MSDN: ProcessStartInfo.StandardOutputEncoding](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.standardoutputencoding?view=netstandard-2.1#System_Diagnostics_ProcessStartInfo_StandardOutputEncoding)
* [MSDN: ProcessStartInfo.StandardErrorEncoding](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.standarderrorencoding?view=netstandard-2.1#System_Diagnostics_ProcessStartInfo_StandardErrorEncoding)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.linx.software/reference/plugins/utilities/content/commandline.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
