RUN function
Syntax
Arguments
- command_lineCharacter
The Windows command that you wish to run.
- show_windowLogical
Default = .T. If .T., Display window. If .F., Hide window.
- timeoutNumeric
Default = -1. Length in milliseconds to wait before timing out. -1 = INFINITE.
- terminateOnTimeoutLogical
Default = .F.. If a timeout occurs and this parameter is set to true, the created process will be terminated using a pattern that injects a thread into the new process and calls Exit Process. This is to prevent handles from remaining locked. Kill process (TerminateProcess()) does not release handles gracefully.
Discussion
The RUN() function runs a command and waits until it is completed before returning control to Alpha Anywhere.
If an error occurs, the RUN() function will fail with an error. If RUN() fails, use ON ERROR GOTO to trap the error information.
Example Interactive Window Session:
Example
? Run("CMD.EXE /C \"DIR C:\*.* /s\"", .t.,1000,.t.) ERROR: Application timed out.
When used in web or mobile applications, you cannot run any programs with RUN() that require user input. RUN() is executed on the Application Server in web and mobile applications, and the user cannot interact with the script.
See Also