|
Answer» Hi All,
Could anyone help me with coding a batch file I want?
I have one exe file. Once I double click it, a black DOS window pops up and ask me "what name the text file has". I have to type in the full name with extension. After pressing enter, one more question followed up in the same black DOS window something LIKE "how many columns in your file? 1. 10 columns; 2. 100 columns: 3. 150 columns. Thereafter, the exe file will ask a few more similar questions.
I want to let the exe process a number of input text files, only the names and data of input files are different, but actually the number of columns and the number of rows etc. are all the same.
So I thought maybe a batch file can run this exe (with answering promoted questions) in a batch mode.
The code in a bat file may look like:
@ECHO off :: Let the exe run and process file1 start C:\Batexe\myprogram.exe :: Could anyone help with the code to answer following up questions automatically (no need to even display the questions)? :: Could anyone help with the code to answer following up questions automatically (no need to even display the questions)? :: Could anyone help with the code to answer following up questions automatically (no need to even display the questions)? :: Could anyone help with the code to answer following up questions automatically (no need to even display the questions)?
:: Let the exe run and process file2 :: Could anyone help with the code to answer following up questions automatically (no need to even display the questions)? :: Could anyone help with the code to answer following up questions automatically (no need to even display the questions)? :: Could anyone help with the code to answer following up questions automatically (no need to even display the questions)? :: Could anyone help with the code to answer following up questions automatically (no need to even display the questions)?
:: Let the exe run and process file3 . . . I have maybe 100 text input files. The above code blocks I may repeat 100 times (feel stupid). Hope I have made myself clear. So could anyone help me? Thanks in advance!!!
Put the ANSWERS to the questions in a text file and redirect it, or pipe it into the dos PROGRAM.
If you tell us what the dos program is than we can test if that will work and provide some code.Hi,
Thanks for your quick input.
What do you mean what the DOS is? It is a 100kb single file (xxx.exe). I got from a workmate. I can run it smoothly under my win7. I do not think I can upload the xxx.exe to this forum to share with you great guys.
What do you mean "Put the answers to the questions in a text file and redirect it, or pipe it into the dos program." You mean a bat file containing one line:
"C:\xxxx.exe" < input.txt >>
where the input.txt contains something like the following: 1.txt 1 gaussian y y
Forgive me if I look like knowing nothing... Can anyone suggest something more? Really appreciate!!!Quote from: Batexe on January 19, 2013, 05:29:42 AM What do you mean "Put the answers to the questions in a text file and redirect it, or pipe it into the dos program." You mean a bat file containing one line:
"C:\xxxx.exe" < input.txt or type input.txt | "C:\xxxx.exe"
where the input.txt contains something like the following: 1.txt 1 gaussian y y
Yes, that is the technique. See above for the command lines.
You can put the filenames in a single text file and read them in for you 100 loops.I have to say - super!
Thank you a lot! You simply make my day!
|