# Shell_ExecuteWithTimeout

> Executes specified program/command using specified options.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/shell-function/shell-executewithtimeout/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Executes specified program/command using specified options

### Syntax

Shell_ExecuteWithTimeout(sProgram, sArgument, bCheckProgramExistence, iTimeout) As Boolean

### Parameters

#### sProgram (String)

Program/command to execute

#### sArgument (String)

Command line arguments

#### bCheckProgramExistence (Boolean)

Check for existence of program

#### iTimeout (Integer)

How long in minutes should the function wait for the process to exit

### Return value

If the process exits with an error function will return false. If timeout occurred then gbValue will be false but the function will return true. If the process ended with success and no timeout was met gbValue is true and the function will return true

### Example

**VBScript**

```vb
If bStatus Then bStatus = Shell_ExecuteWithTimeout(gsWindowsDir & "\Regedit.exe", gsTempDir & "\Regfile.reg /S", True, 30)
If bStatus Then
  If Not gbValue Then
    'Handle timeout situations. ID of started process can be found with giProcessID
  End If
Else
  'Process exited with an error
End If
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
