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!
Create Batch File to Run EXESave your file with the file extension . bat , e.g. run-exe-program. bat and double click on it to run the .exe program.
You are able to prompt a user for input using a Batch script function.
Every executable accepts different arguments and interprets them in different ways. For example, entering C:\abc.exe /W /F on a command line would run a program called abc.exe and pass two command line arguments to it: /W and /F.
EXE files are different from BAT files since they contain executable binary data rather than plain text commands. They are stored in the Portable Executable (PE) format. The EXE file format includes various headers and sections that tell Windows how to run a program.
try this:
run.bat:
myCode.exe %1 %2 %3
call example:
run.bat 111 222 333
and with file:
run.bat < input.txt
This may also work:
(
echo 2
echo 3
echo 8
) | mycode.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With