Exec - running a dos program from pascal

I'm trying to run a DOS batch file within a small pascal program using exec
The whole command I wish to use is C:\temp\go_docsl 07
I've coded :
exec ('c:\temp\go_docsl','07');
The code compiles OK and runs, but this command is ignored.
Am I doing it right. The pascal help file is a bit vague on thid
chrikellAsked:
Who is Participating?
 
VIBESPROConnect With a Mentor Commented:
it seems that the program is quiting on you.  this is because there may not be enough memory.

to find out what is run use the doserror variable to find out what error you are getting.
if it uis a memory problem redure the maximum heap size, like this:

{$M 8192,4192,65536}

and try to use a exe file instaed of a bat file.  when u use a bat file you may run into more errors because the exec procedure.  

0
 
My name is MudSystems EngineerCommented:
{$M 8192,8192,655360}
Program ExceDemo;

Begin
  SwapVectors;
  Exec('c:\temp\go_docsl.exe','07');
  SwapVectors;
End.
0
 
chrikellAuthor Commented:
I've tried implementing this but it seems to make no difference. Incidentally, the file I am trying to run is a .bat file. I have tried using an .EXE file with this solution as well with no success. My whole program is:

{$M 8192,8192,655360}
program dcdocsl;
uses crt,dos;
var
        inps:string;

begin
      clrscr;
      writeln('Dcdocsl strip prog');
      writeln('Ensure you have moved dcdocsl.?? to SPOOL directory');
      writeln;
      write('What is the extension number of the dcdocsl file > ');
      readln(inps);
      swapvectors;
             exec ('c:\temp\go_docsl.bat',inps);
      swapvectors;
end.

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
BatalfCommented:
Have you tried to just pass in :

exec('c:\temp\go_docsl.bat','');

It Works fine on my PC.

Regards
Batalf
0
 
dbruntonCommented:
exec('c:\command.com', '/c c:\temp\go_docsl   07');

Try the above line
0
 
VIBESPROCommented:
what's up man!  Pay up!  
0
All Courses

From novice to tech pro — start learning today.