Path: utzoo!attcan!uunet!telxon!gorpong From: gorpong@telxon.uucp (Gordon C. Galligher) Newsgroups: comp.lang.c Subject: Re: execl()'ing batch files in DOS Summary: (use system() or execl("...", "...", "-c", "....", NULL);) Keywords: batch, execl, dos Message-ID: <53@telxon.UUCP> Date: 18 May 89 17:34:04 GMT References: <302@ohs.UUCP> Sender: news@telxon.UUCP Reply-To: gorpong@telxon.UUCP (Gordon C. Galligher) Organization: Telxon Corporation, Akron Ohio Lines: 26 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. Try: system("tryit.bat"); (Which will invoke whatever COMSPEC points to) Try: execl("\command.com", "command", "-c", "tryit.bat", NULL); This should work, but then you are forcing it to try to execute \command.com. You should look at either: 1). The 'SHELL' environment variable 2). The 'COMSPEC' environment variable One of these is bound to point to the try command processor which you should execute (but no guarantees.....:-) -- Gordon. Gordon C. Galligher <|> ...!uunet!telxon!gorpong <|> gorpong@teleng.uucp.uu.net Telxon Corporation <|> "Before they warped out of orbit I beamed the while kit Akron, Ohio, 44313 <|> and kabootle into their engine room." - Scotty (216) 867-3700 (3512)<|> (Trouble with Tribbles)