Jump to content

Run exe (with answering promoted questions) in a batch mode


Recommended Posts

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!!! I have posted my question else where, but I will keep all of you posted.

Link to comment
Share on other sites


Hi All,

I learnt that a batch file has

"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

It worked. Super. Cheers.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...