Help, Executing DOS commands

This program includes the Procedure you are looking for

{$M 8192,0,0}

uses Dos;

procedure RunProgram(S : string);
var   Command : string;
  Command := '/C ' + S;
  Exec(GetEnv('COMSPEC'),Command); { This is the line that Executes }

  Write('Copying SCANDISK.LOG...');          { Show Message }
  RunProgram('COPY C:\SCANDISK.LOG D:\');    { Run program  }

I'll run through the program for the novices around although I'm
hardly an expert.

1. You need to set the M$ directive (is that how you spell it?),
   I've found that "8192" is usually enough but you can do the
   same thing by choosing "Compiler" under the "Options Menu"
   (Using TP Version 5, That's right someone's still using TP5)
2. The Procedure 'RunProgram' simply runs the program, I've come
   to the conclusion that "GetEnv('COMSPEC')" must run COMMAND.COM
   which is very helpful because by using COMMAND.COM any program
   which is located within the "PATH" (Set in AUTOEXEC.BAT) can
   be run
3. Finally the program simply shows a message and copies the
   file C:\SCANDISK.LOG to D: drive using the usual DOS Prompt

I've tested this program and it works fine but for really memory
'hungry' programs you might need to fiddle around with the M$
directive. Freeing up conventional memory often helps too!

A hint when using this procedure is to leave a few lines at the
bottom of the screen blank and when you run "the procedure"
set the textcolor to BLACK on BLACK and GotoXY(23,1) (or whatever)
so that the messages from the other program are not shown.

ie When you run COPY it shows a "1 File(s) copied" message after
   it's copied the file. By setting the colors to BLACK on BLACK
   you wont be able to see these messages. I've found my programs
   look a lot more professional after doing this.

I'm glad to help you out, but if you find any use for my
procedure I'd like a few words of thanks if you don't mind.
Damien <>