Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!unmvax!gatech!prism!rr5 From: rr5@prism.gatech.EDU (RAKES,RICHARD B) Newsgroups: comp.lang.c Subject: Re: execl()'ing batch files in DOS Keywords: batch, execl, dos Message-ID: <681@hydra.gatech.EDU> Date: 17 May 89 16:10:27 GMT References: <302@ohs.UUCP> Reply-To: rr5@prism.gatech.EDU (RAKES,RICHARD B) Organization: Georgia Institute of Technology Lines: 34 In article <302@ohs.UUCP> mday@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@prism.gatech.edu