Click here to Skip to main content
15,912,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

I've been trying to create a batch file that passes text to a console application. In this case its an exe that trims a large .dat file to the start/stop time and date specified. It expects the file name, start, stop, and a y(es) response to start the cut. The script below works, but after submitting the final "y" response, the .exe terminates without even attempting to start the cut.

Can anyone see what could be wrong? Tried ping delays, pause, /wait - all to the same effect.

@echo Off

Set program=c:\rtdm_cutter.exe

(
echo 20121126_191613_09224_RTDM.BIN
echo 2012/11/25 15:00:00
echo 2012/11/25 15:15:00
echo y
) |start /realtime /B /wait %program%
Posted

1 solution

Try this:

CALL "c:\rtdm_cutter.exe" 20121126_191613_09224_RTDM.BIN "2012/11/25 15:00:00" "2012/11/25 15:15:00" y
 
Share this answer
 
Comments
Member 9652578 5-Dec-12 20:39pm    
Thanks for responding. This doesn't seem to pass the first argument. Running the bat runs the program but it asks for the file name.
BC @ CV 6-Dec-12 10:18am    
Perhaps you need a switch as in...

CALL "c:\rtdm_cutter.exe" /f 20121126_191613_09224_RTDM.BIN "2012/11/25 15:00:00" "2012/11/25 15:15:00" y

I don't know if the name of the switch for this particular app is /f but you should. If you don't then perhaps your app has a help feature, which is usually accessible by passing /h or ? as in....

CALL "c:\rtdm_cutter.exe" /h

It sounds like you might benefit from studing DOS. Read here and here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900