execl()'ing batch files in DOS

Earl H. Kinmonth ked at garnet.berkeley.edu
Thu May 18 07:35:50 AEST 1989


>>
>>	execl("\command.com", "tryit.bat", NULL);
>>

There are a number of errors in this.  The proper call to execl is

execl(char *path, char *arg0, char *arg1, char *argN, NULL);

Usually path = arg0 = executable program name.

Second, command.com -c string is the pattern used to get command.com to
execute something other than keyboard input.  Assuming command.com is
in the root directory of drive c:, try the command:

	path = "c:/command.com";
	execl(path,path,"-c","tryit.bat",NULL);

You should not need to use the backslash.  If your version of execl
is brain-dead and you must use a backslash, double it to get proper
string interpretation.

Earl H. Kinmonth
History Department
University of California, Davis
Davis, California  95616
916-752-1636 (2300-0800 PDT for FAX)
916-752-0776 (secretary)
ucbvax!ucdavis!ucdked!cck (email)
cc-dnet.ucdavis.edu [128.120.2.251]
	(request ucdked, login as guest)



More information about the Comp.lang.c mailing list