EXEC

Purpose: Execute an external program.

Format: EXEC    program name    <optional parameters>

Notes:  Use this command to start and run another program. program name  must be a valid executable file. Parameters are optional and are passed on to the executable.  The script program continues to run after the executable is started.

If the program cannot be started, an error message will be displayed with one of the following codes:
 

Value
Meaning
0 System was out of memory, executable file was corrupt, or relocations were invalid. 
2 File was not found. 
3 Path was not found. 
Attempt was made to dynamically link to a task, or there was a sharing or network-protection error. 
Library required separate data segments for each task. 
8 There was insufficient memory to start the application. 
10 Windows version was incorrect. 
11  Executable file was invalid. Either it was not a Windows application or there was an error in the .EXE image. 
12  Application was designed for a different operating system. 
13  Application was designed for MS-DOS 4.0. 
14  Type of executable file was unknown. 
15  Attempt was made to load a real-mode application (developed for an earlier version of Windows). 
16  Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read-only.
19  Attempt was made to load a compressed executable file. The file must be decompressed before it can be loaded. 
20  Dynamic-link library (DLL) file was invalid. One of the DLLs required to run this application was corrupt. 
21  Application requires Microsoft Windows 32-bit extensions.

Examples:

# Example 1:
# Calling EXEC directly.

exec "notepad c:\fpimage\bin\fpimage.cfg"
pause "Example 1"

# Example 2:
# Using a text variable.

$filename = "*.bmp"
getfile $filename "Select a bitmap file to edit"

$tstring = "pbrush " $filename

exec $tstring
pause "Example 2"

# The programs continue to run after the script
# is exited.

exit