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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
BatalfCommented:
Have you tried to just pass in :

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

It Works fine on my PC.

Regards
Batalf
0
Get your problem seen by more experts

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

VIBESPROCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dbruntonCommented:
exec('c:\command.com', '/c c:\temp\go_docsl   07');

Try the above line
0
VIBESPROCommented:
what's up man!  Pay up!  
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Pascal

From novice to tech pro — start learning today.