execl()'ing batch files in DOS

Rahul Dhesi dhesi at bsu-cs.bsu.edu
Thu May 18 06:51:45 AEST 1989


>>	execl("\command.com", "tryit.bat", NULL);
>>
>>and perror() tells me "No such file or directory."

     char option[] = "/c";
     char *comspec;

     if (msdos_version <= 3)
        option[0] = getswitchar();       /* Turbo C 2.0 */
     else 
        printf ("Please upgrade to UNIX\n");
        
     if ((comspec = getenv("COMSPEC")) == NULL)
        comspec = "/command.com";
     execl (comspec, comspec, option, "tryit.bat", (char *) NULL);
     perror ("execl");

I have not tested this.
-- 
Rahul Dhesi <dhesi at bsu-cs.bsu.edu>
UUCP:    ...!{iuvax,pur-ee}!bsu-cs!dhesi



More information about the Comp.lang.c mailing list