execl()'ing batch files in DOS

Gordon C. Galligher gorpong at telxon.uucp
Fri May 19 03:34:04 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.

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 at 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)



More information about the Comp.lang.c mailing list