[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
NAME: Exec
USE: Runs a specified program or dos command. Exec takes two
arguments including the path of the filename and the command
line. To execute a dos command, COMMAND.COM must be given
as the filename and '/C' must prefix the required command.
For instance: Exec('COMMAND.COM','/C DIR/P');
Errors are reported through DosExitCode and DosError.
NOTE
The Exec procedure will not modify memory, therefore sufficient
memory must be available before performing the exec procedure
or DosError will return a value of 8.
DEPENDENCY: The DOS unit must be used placed in the uses section.
SYNTAX: Exec(filename,commandline);
Exec(String,String);
EXAMPLE: Program TestExec;
Var
Filename,
CommandLine : String;
DError : Integer;
Begin
Write('Enter Program to run: ');
Readln(Filename);
Writeln;
Write('Enter Program command line: ');
Readln(CommandLine);
{$I-}
Exec(FileName,CommandLine);
{$I+}
DError := DosError;
If DError <> 0 then
Writeln('Error ',DError,' *** Cannot run program);
end.
See Also:
DosExitCode
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson