I have an executable that I can run interactively from the commandline. Here is how it looks:
C:\Users\Me> my_executable.exe # Running the executable from CMD
Welcome! Please choose one:
0: Exit
1: Sub-task 1
2: Sub-task 2
Enter your input: 2 # I entered this interactively
Sub-task 2 chosen.
Please choose next option:
0: Return to previous menu
1: Connect to server
2: Disconnect from server
3: Call server API 1
4: Call server API 2
Enter your input: 1 # I entered this interactively
I cannot specify the input arguments before-hand using flags. For instance, nothing of this sort works:
C:\Users\Me> my_executable.exe 2 # Running the executable from CMD with first argument specified
Sub-task 2 chosen.
Please choose next option:
0: Return to previous menu
1: Connect to server
2: Disconnect from server
3: Call server API 1
4: Call server API 2
Enter your input:
What would be the right way to automate this using a batch file? I came across a similar requirement in this SO thread, but the difference is that the executable there takes command-line arguments (unlike in my case).