> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IXtfRemoteRunClient::Run Method

> IXtfRemoteRunClient::Run Method

# IXtfRemoteRunClient::Run Method

Run a given command on the console.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
public:
HRESULT Run(
         LPCWSTR pszCommandLine,
         LPCWSTR pszWorkingDirectory,
         DWORD dwFlags,
         DWORD dwPeriod,
         IXtfRemoteRunCallback *pCallback
)  
```

<a id="ID4EG" />

<a id="parametersSection" />

### Parameters

*pszCommandLine*\
Type: LPCWSTR

The command line to execute on the remote console.

*pszWorkingDirectory*\
Type: LPCWSTR

The working directory on the remote console.

*dwFlags*\
Type: DWORD

One or more of the flags described in Remarks.

*dwPeriod*\
Type: DWORD

When output is redirected, it is batched and sent back to the client periodically. This value specifies the number of milliseconds between batching operations.

*pCallback*\
Type: [IXtfRemoteRunCallback \*](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunCallback/interfaces/ixtfremoteruncallback)

A callback used when standard input or output are redirected.

<a id="ID4EP" />

<a id="retvalSection" />

### Return value

Type: HRESULT

HRESULT success or error code.

<a id="remarks" />

## Remarks

The dwFlags parameter is a bitwise-AND of any of the following values:

| Flag value               | Effect                                                                                                                          |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| XTFRUN\_WAIT             | Wait for the command to complete. Default behavior is to run the command and return immediately without waiting for completion. |
| XTFRUN\_GUEST\_USER      | Run under the guest user account. Default behavior is to run as the elevated system user.                                       |
| XTFRUN\_REDIRECT\_INPUT  | Redirect standard input through the given pCallback. This implies XTFRUN\_WAIT.                                                 |
| XTFRUN\_REDIRECT\_OUTPUT | Redirect standard output through the given pCallback. This implies XTFRUN\_WAIT.                                                |
| XTFRUN\_REDIRECT\_BOTH   | Redirect both standard input and standard output through the given pCallback. This implies XTFRUN\_WAIT.                        |

The [IXtfRemoteRunCallback](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunCallback/interfaces/ixtfremoteruncallback) contains both an input and an output callback function. You can populate either or both of these member whether you need input *or* output for a function or you need input *and* output for a function.

For more information about callback *input*, see [IXtfRemoteRunCallback::Input](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunCallback/methods/ixtfremoteruncallback_input).

For more information about callback *output*, see [IXtfRemoteRunCallback::Output](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunCallback/methods/ixtfremoteruncallback_output).

<a id="requirements" />

## Requirements

**Header:** xtfremoterun.h

**Library:** xtfremoterun.lib

**Supported platforms:** Windows (for XBOX console tools)

## See also

[XtfRemoteRun](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunClient/interfaces/ixtfremoterunclient)\
[IXtfRemoteRunClient](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunClient/interfaces/ixtfremoterunclient)\
[IXtfRemoteRunCallback](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunCallback/interfaces/ixtfremoteruncallback)


## Related topics

- [IXtfRemoteRunClient Interface](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunClient/interfaces/ixtfremoterunclient.md)
- [XtfCreateRemoteRunClient Method](/reference/tools/xtf/xtfremoterun/methods/xtfremoterun_xtfcreateremoterunclient.md)
- [IXtfRemoteRunCallback::Input Method](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunCallback/methods/ixtfremoteruncallback_input.md)
- [IXtfRemoteRunCallback::Output Method](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunCallback/methods/ixtfremoteruncallback_output.md)
- [IXtfRemoteRunCallback Interface](/reference/tools/xtf/xtfremoterun/classes/IXtfRemoteRunCallback/interfaces/ixtfremoteruncallback.md)
