Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!shelby!Portia!mesmo From: mesmo@Portia.Stanford.EDU (Chris Johnson) Newsgroups: comp.lang.c Subject: Re: execl()'ing batch files in DOS Keywords: batch, execl, dos Message-ID: <2335@Portia.Stanford.EDU> Date: 17 May 89 19:59:06 GMT References: <302@ohs.UUCP> Sender: Chris Johnson Reply-To: mesmo@Portia.Stanford.EDU (Chris Johnson) Organization: Stanford University Lines: 32 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. 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@portia.stanford.edu === "Grad school sucks rocks" "Imitation is the sincerest form of plagiarism" -- ALF ==============================================================================