I have a .exe which requires 3 integers as input. For example:
myCode.exe < input.txt
In input.txt:
2
3
8
Now I want to put the command in a batch file. how can I write the batch file?
(Here I want to pass 3 fixed integers in the batch file)
THANKS!
This may also work:
(
echo 2
echo 3
echo 8
) | mycode.exe
Here is a batch one-liner that will create the file for you and supply it as an input to the myCode.exe
:
echo 2 3 8 > output & myCode.exe output
Otherwise, you'll probably need to modify your program to read the arguments directly from command line.
It's possible to redirect the program standard input/output/error streams to or from a file, but I think there is no way to redirect a command line contents to a standard input stream. Take a look at this page for details on batch redirection.
try type input.txt | myCode.exe