How to make a batch file that send application an input char
I'm writing a batch file that launch an开发者_如何学C application.
app.exe
After the application is launched, I'm getting a list of options in the console, and the program waits for input, for example:
a: start session b: end session c: end
How do I make the batch type a
?
Other than using echo
as @npclaudiu suggested, you could also write the expected input to a text file and then have the app read the file:
app.exe <input.txt
This works if the app expects more than one line of input.
First, make sure if the application supports command line arguments. For example, at your command prompt, type:
C:\> app.exe /?
or
C:\> app.exe -h
or
C:\> app.exe --help
If it doesn't, try using
echo a | app.exe
精彩评论