0

In Windows, I want to run a batch script in perl. This batch script wants two inputs from the user, but I want these inputs to come from the perl script. I've tried doing an echo | batchscript but that only works for one input. Currently I'm implementing it like this:

chdir "C:\\folder\\folder\\folder";
`some batch script`;
`echo variable`;
`echo filename`;

Another way I tried:

chdir "C:\\folder\\folder\\folder";
`echo variable | some batch script`;
`echo filename`;

The variable and filename are the two inputs that the script prompts for before continuing. Neither works. Anything helps. Thanks

2
  • You say "shell" script but your sample code uses Windows-style directories. Do you mean to say "batch file"? Commented Oct 18, 2013 at 22:14
  • Yes. I did mean batch file. The perl script is being ran in Window's CMD. Commented Oct 21, 2013 at 12:22

1 Answer 1

1

As the script reads from stdin:

my $script_out = qx(printf "%s\n" variable filename | script.sh);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.