Previous: EnvStr function To the Table of Content Next: FExpand function

- 4.24.2.9 -
Standard Units
Dos Unit
Dos Unit Procedures and Functions

Exec procedure

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: EnvStr function To the Table of Content Next: FExpand function
EnvStr function Table of Content FExpand function

- 4.24.2.9 -