Skip to content

Shell_ExecuteWithTimeout

Executes specified program/command using specified options

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

Program/command to execute

Command line arguments

Check for existence of program

How long in minutes should the function wait for the process to exit. If the timeout is reached, the process keeps running.

Boolean, TRUE if the process was started. The function doesn’t fail when the exit code isn’t 0.

  • If the process ends before the timeout, gbValue is TRUE and giErrorLevel contains the exit code.
  • If the timeout is reached, gbValue is FALSE. The ID of the process is in giProcessID.
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
ElseIf giErrorLevel <> 0 Then
'Process exited with an error
End If
End If

Scripting Guidelines

Constants Package Property Variables