Newsgroups: comp.sys.ibm.pc Path: utzoo!utgpu!jarvis.csri.toronto.edu!genie.csri!wayne From: wayne@csri.toronto.edu (Wayne Hayes) Subject: Re: Executing .BAT files Message-ID: <1989Jun20.004016.5887@jarvis.csri.toronto.edu> Organization: University of Toronto, CSRI References: <4112@merlin.usc.edu> <584@megatek.UUCP> Distribution: na In article <584@megatek.UUCP> hollen@zeta.megatek.uucp (Dion Hollenbeck) writes: >From article <4112@merlin.usc.edu>, by danking@aludra.usc.edu (Dan King): >> >> My problem is that I can't seem to be able to use either the EXEC or >> SPAWN calls to execute a .BAT file. A perusal of the TC documentation >> >This information is not necessarily accurate but should point you >in the right direction to get the correct information. > >What you should do is to EXEC or SPAWN command.com with, I believe, There's an even easier, and I think more memory efficient method. Write a function that converts a char *arg[] array to single string (via strcat(line, argv[i]), strcat(line, " ")), and then invoke the "system()" function. I believe the system() call uses the already- resident command.com. As an added bonus, this is much more portable, however useless if your .exe file uses a main(argc, argv, envp), 'cuz envp can't be passed to the system call. ------------------------------------------------------------------------------ "Open the pod bay doors, HAL." "I'm sorry Dave, I'm afraid I can't do that." Wayne Hayes INTERNET: wayne@csri.toronto.edu CompuServe: 72401,3525