ex5.pp 321 B

123456789101112131415
  1. Program Example5;
  2. uses Dos;
  3. { Program to demonstrate the Exec and DosExitCode function. }
  4. begin
  5. {$IFDEF Unix}
  6. WriteLn('Executing /bin/ls -la');
  7. Exec('/bin/ls','-la');
  8. {$ELSE}
  9. WriteLn('Executing Dir');
  10. Exec(GetEnv('COMSPEC'),'/C dir');
  11. {$ENDIF}
  12. WriteLn('Program returned with ExitCode ',Lo(DosExitCode));
  13. end.