echo y| call test.cmd
pause
test.cmd
SET /p input=Input any key!
@echo ::::::::::::::::::
@echo :::::%input%::::::
@echo ::::::::::::::::::
pause
--------------------------------------------------
also
If the program reads input from STDIN (most likely), not specifically from the keyboard, it can be done just fine.
Ezbear, suppose you answer "Yes" to the prompt. This would run the program and automatically answer the prompt "Yes":
echo Yes|prog.exe [parameters]
The strings "prog.exe" and "[parameters]" are just examples of the program name and its parameters.
If there are multiple prompts, you can do it like this (let's say the answers are "Yes" to the first prompt and "Blue" to the second):
@echo off
echo Yes> %temp%
echo Blue>> %temp%
prog.exe [parameters] <%temp%
However, beware: you won't be able to type in anything else for an eventual third prompt from the program. If the information on the source file (%temp%.\$) is not enough for feeding the program so it completes its process, it will stuck waiting for further input and you won't be able to type it (it will crash, basically). So, you gotta put on the source file all the input that the program will need.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br
additional links:
http://ss64.com/nt/
http://www.aumha.org/a/batches.php
No comments:
Post a Comment