execl()'ing batch files in DOS
Chris Johnson
mesmo at Portia.Stanford.EDU
Thu May 18 05:59:06 AEST 1989
In article <302 at ohs.UUCP> mday at ohs.UUCP (Matthew T. Day) writes:
>Does anybody know if it's possible to execl() a batch file in DOS? I am
>using MicroSoft C v5.1, and using MS-DOS v3.30. I have tried:
>
> execl("\command.com", "tryit.bat", NULL);
>
>and perror() tells me "No such file or directory." Any help or input would
>be appreciated.
Sorry for posting this, I have trouble mailing to UUCP sites.
There are at least two errors in the above line:
1) if you want to specify the root directory "\",
you will have to use the escape sequence "\\" in
the first argument to execl (re: K&R 1ed p.180)
2) you are using "tryit.bat" as the first argument
to command.com; this doesn't do what you want it to
Why not use:
system("tryit.bat");
?? This invokes command.com, and then attempts to locate & run
your batch file.
--
==============================================================================
Chris M Johnson === mesmo at portia.stanford.edu === "Grad school sucks rocks"
"Imitation is the sincerest form of plagiarism" -- ALF
==============================================================================
More information about the Comp.lang.c
mailing list