Previous: 4.24.2.8. EnvStr To the Table of Contents Next: 4.24.2.10. FExpand
4.24.2.8. EnvStr Table of Contents 4.24.2.10. FExpand

- 4.24.2.9. -
Table of Contents
4. Standard Units
4.24. DOS - MSDOS support unit
4.24.2. DOS Unit Procedures and Functions
4.24.2.9. Exec


4.24.2.9. Exec

Targets: MS-DOS, OS/2, Win32


Dos Unit

Executes a specified program with a specified command line.

Declaration:
procedure Exec(Path, CmdLine: string);
Remarks:
Path is the drive, directory, and program name to execute. CmdLine contains the command line arguments.

Exec transfers control to the program specified by Path. Memory allocation is not modified by Exec. Upon completion of Exec use DosExitCode to determine the exit code of the program. Exec also sets the value of DosError if an error occurred.

Exec does not execute programs that require File Control Blocks (FCBs).

Example:
begin
  Exec('PROGRAM.EXE','');
  WriteLn(Hi(DosExitCode),'.', Lo(DosExitCode),'.',DosError);
end.
See also:
DosExitCode


Previous: 4.24.2.8. EnvStr To the Table of Contents Next: 4.24.2.10. FExpand
4.24.2.8. EnvStr Table of Contents 4.24.2.10. FExpand

- 4.24.2.9. -