Calling an exe file from a batch program
Posted: 14 Jan 2011 11:18
Hello,
I am working on a project which requires execution of a program (in fortran - with no access to the original fortran code being available) currently available only in the form of an exe file. The usual approach towards using this program (say myprog.exe) involves the following steps:
C:\>myprog
Enter the name of the input file:
Enter the name of the output file:
A Boolean Condition (Y/N type):
program executed.
C:\>
Basically, the console waits for the user the enter the appropriate input file name, prints the second line, then waits for the user to enter the output file name, prints the third line, then waits for the user to enter a Y/N type response and executes saving the necessary output file in C drive.
My purpose is to write a batch file which will execute myprog and pass all three parameters simultaneously. Being very new to the MS DOS Batch Language, I tried writing a simple batch file entering the name of the program and all three parameters line by line. But when I try to execute this batch code, it prints the first line ("Enter the name of the input file:") and waits for the user to enter that information. I would appreciate any pointers in the form of sample code or quick reference help documentation that could directly aid in solving the above problem. In the longer run, I hope to run this batch file iteratively with different input files to generate different output files which will then be used by the code I am developing for this project.
Thank you for taking the time to read this post. Please let me know if you need further information.
I am working on a project which requires execution of a program (in fortran - with no access to the original fortran code being available) currently available only in the form of an exe file. The usual approach towards using this program (say myprog.exe) involves the following steps:
C:\>myprog
Enter the name of the input file:
Enter the name of the output file:
A Boolean Condition (Y/N type):
program executed.
C:\>
Basically, the console waits for the user the enter the appropriate input file name, prints the second line, then waits for the user to enter the output file name, prints the third line, then waits for the user to enter a Y/N type response and executes saving the necessary output file in C drive.
My purpose is to write a batch file which will execute myprog and pass all three parameters simultaneously. Being very new to the MS DOS Batch Language, I tried writing a simple batch file entering the name of the program and all three parameters line by line. But when I try to execute this batch code, it prints the first line ("Enter the name of the input file:") and waits for the user to enter that information. I would appreciate any pointers in the form of sample code or quick reference help documentation that could directly aid in solving the above problem. In the longer run, I hope to run this batch file iteratively with different input files to generate different output files which will then be used by the code I am developing for this project.
Thank you for taking the time to read this post. Please let me know if you need further information.