By using a COM file, we can get around the program flow problems that plague us when running batch programs from other batch programs. 

If you've managed to get this far, I have to assume you know how to take a list like:
and add key words to the beginning of each line:
Enter new time: data1
Enter new time: data2
Enter new time: data3

The problem with running a file like the one above is that you will typically create an ENTER.BAT which will try to process it's third argument (new being 1, time: being 2, and data... being 3). This will work for the first line, but once your ENTER.BAT finishes, control will pass "up", not to the next line! If we had an ENTER.COM or an ENTER.EXE instead of an ENTER.BAT, things would continue normally to the next line. What we need in this mythical ENTER program is that it do no more than start another program. I know three programs that fit that bill: LOADFIX.COM (from DOS 5,6,&7), COMMAND.COM, and START.EXE (DOS 7). No, you can't use CALL. CALL is internal to COMMAND.COM, and isn't a standalone command. The problem with START and COMMAND is that they both require options to work as desired (COMMAND needs the /C option, and START needs the /W option). That leaves LOADFIX.COM.

All you have to do is make a copy of LOADFIX.COM and name it ENTER.COM. If you don't have loadfix, look for it on your Windows 95 CDROM in the \Other\Oldmsdos directory or download it from Microsoft.

Enter new time: data1 
Enter new time: data2 
Enter new time: data3
@echo off
copy c:\windows\command\
call data.bat
echo Processing %2
When MAIN.BAT CALLs DATA.BAT, DATA.BAT will run ENTER.COM. ENTER.COM will in turn start NEW.BAT, passing it two parameters (time: and data...). NEW.BAT is then responsible for actually processing the listed items. Note that I created and deleted ENTER.COM on-the-fly. You might want to create and run an "ENTER.BAT" later on, and having an ENTER.COM floating around could really screw you up.

Lost? Look at the site map.

Bad links? Questions? Send me mail.

Ask Jeeves