You are here: Start » Filter Reference » System » Process » Execute_WaitForExit
Module: | FoundationLite |
---|
Executes a system command, captures output and waits for completion.
Name | Type | Description | |
---|---|---|---|
![]() |
inCommand | File | System command to be executed. |
![]() |
inArguments | StringArray | Arguments for the command. |
![]() |
inWorkingDirectory | Directory | Working directory in which the command will be executed. |
![]() |
inEncoding | String | Expected encoding of command output. |
![]() |
outReturnCode | Integer | Return code of the executed command. |
![]() |
outResult | String | Captured text data. |
![]() |
outRawResult | ByteBuffer | Captured raw bytes. |
Description
Filter executes a command provided in inCommand with inArguments arguments. The command will be executed in a directory provided in inWorkingDirectory.
Output outResult contains text captured during execution of the command.
Usually value 0 on output outReturnCode means that command was executed correctly.
Program execution is blocked until command execution is finished.
inEncoding input determines which encoding will be used for reading output text:
- UTF8 - UTF8
- UTF16 - UTF16, little endian
- OEM - current DOS code page (for example 850)
- ANSI - current Windows code page (for example 1252)
- CP + number - specific code page, for example CP1250
- RAW - skips text conversion, outResult will be empty. User can provide their own conversion using outRawResult.
Note that code pages are supported on Windows only.
Examples
How to get name of the current user:
- Set inCommand to C:\Windows\System32\cmd.exe.
- Add argument /c whoami to inArguments.
- User name will be provided on outResult output.
Example below shows how to shut down computer at desired time using Execute_WaitForExit filter.

Remarks
Usage of this filter is not recommended in FIL.
On Windows both standard output and standard error streams are redirected. On Linux only standard output is redirected.
Errors
This filter can throw an exception to report error. Read how to deal with errors in Error Handling.
If an error occurred during the process execution a value -1 will be returned on outReturnCode.
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Encoding not supported on Linux: provided encoding |
Complexity Level
This filter is available on Advanced Complexity Level.
Disabled in Lite Edition
Filter Group
This filter is member of Execute filter group.