Reputation: 618
My batch file looks like:
perl program.pl
input.txt
My perl program asks for input file via user input. But when I am running my batch file, it just starts a perl program but do not automatically give "input.txt" on the next line as user input.
How to get it done.
Upvotes: 0
Views: 401
Reputation: 67206
"Execute" your Batch file this way:
cmd < theFile.bat
For further details, see this post.
Upvotes: 1
Reputation: 70923
echo input.txt|perl program.pl
In your batch file, you have two commands. One to start the perl program and one to open the input.txt file. Each line one command.
If you want the batch file to send the string input.txt
into the perl program, use the echo
command to send the string to stdout, and pipe stdout into the stdin of the perl program.
Upvotes: 1