Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: execl()'ing batch files in DOS Message-ID: <2896@buengc.BU.EDU> Date: 17 May 89 18:28:09 GMT References: <302@ohs.UUCP> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 28 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. Perhaps the backslash is causing the following c to be interpreted literally as a c, i.e., as though the backslash weren't there at all. I.e. it's actually doing the same as execl("command.com", "tryit.bat", NULL); which looks in the current dir, not in the root dir, for command.com. replace the single backslash with a double backslash, and the first will cause the second to be interpreted literally _by_the_compiler_... execl("\\command.com", "tryit.bat", NULL); now the string itself will contain the backslash. --Blair "Good thing it wasn't a trigraph. We might have stepped in it..."