execl()'ing batch files in DOS
RAKES,RICHARD B
rr5 at prism.gatech.EDU
Thu May 18 02:10:27 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.
>--
I am not a DOS user, I mostly program in a UNIX or MAC environment, but I
can make a logical guess as to your problem. Remember that C strings use
the backslash '\' character as an 'escape' character. In your example,
the '\c' is probably being interpreted as simply the ASCII letter 'c' since
I don't think there is a a MSC interpretation for that sequence. Anyway,
what you probably need to do is use two backslashes so that the second
one would be taken literally as in:
execl("\\command.com", "tryit.bat", NULL);
Also, my understanding is that MSC understands the RIGHT way :-) to delimit
directories in a pathname and will handle 'forward slashes.' Thus, an
alternative would be:
execl("/command.com", "tryit.bat", NULL);
--
RAKES,RICHARD B
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp: ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!rr5
Internet: rr5 at prism.gatech.edu
More information about the Comp.lang.c
mailing list