title: Perl script that provides input to batch file
body: <p>I have a batch file "Sample.bat" which I am running using Perl: <code>system("Sample.bat");</code></p>
  
  <p><code>Sample.bat</code> prompts for username and password, these username and password I want to give using a Perl script.  For example, when I run this batch file using Perl:</p>
  
  <pre><code>Enter username:
  Enter password:
  </code></pre>
  
  <p>These two things I have to provide using the Perl script.</p>
  
  <p>Batch file:</p>
  
  <pre><code>@echo off
  set /p username=Enter your username:%1
  set /p password=Enter your password:%2
  </code></pre>
  
  <p>Perl Script:</p>
  
  <pre><code>my $username="Shaggy";
  my $password="shaggy";
  
  my $setup = "C:/sample.bat";
  system("$setup $username $password");
  </code></pre>