title: Passing values to intermediate (runtime) input prompts of Windows command
body: <p>I have a windows exe which displays some copyright information, connects to a server and then prompts for input of username and password.</p>
  
  <p>So whenever I run this, I have to wait for the prompt to input username and password.
  I generally type ahead the username, , password after the command starts displaying copyright information, but that is a crude way.</p>
  
  <p>Is there a better way to pass parameters to a input prompt of windows command, in a batch file, so that i can avoid typing them always?</p>
  
  <p>P.S. In Linux we do this using the &lt;&lt; operator like this</p>
  
  <pre><code>linux_command &lt;&lt;delimiter
  inputparamvalue1
  inputparamvalue2
  delimiter
  </code></pre>
  
  <p>linux_command will run and on first input prompt, it reads inputparamvalue1 and at next input prompt, it reads inputparamvalue2</p>
  
  <p>In response to James, thanks for the advice on security. I will take care of that.  </p>
  
  <p>I tried to implement your solution but that did not work.  </p>
  
  <p>These are my files. Please see if you get any hint.  </p>
  
  <p>vpn.bat</p>
  
  <pre><code>@ echo off    
  "C:\Program Files (x86)\Cisco\Cisco AnyConnect VPN Client\vpncli.exe" connect "mycompanyvpnsite.com"
  </code></pre>
  
  <p>login.txt</p>
  
  <pre><code>myusername  
  mypassword
  </code></pre>
  
  <p>startvpn.bat  </p>
  
  <pre><code>@ECHO OFF  
  CALL vpn.bat &lt; login.txt  
  ECHO I'm back!
  </code></pre>
  
  <p>Result  </p>
  
  <pre><code>D:\&gt;startvpn.bat  
  Cisco AnyConnect VPN Client (version 2.5.6005) .  
  
  Copyright (c) 2004 - 2010 Cisco Systems, Inc.  
  All Rights Reserved.  
  
  
    &gt;&gt; state: Disconnected  
    &gt;&gt; notice: Ready to connect.  
    &gt;&gt; registered with local VPN subsystem.  
    &gt;&gt; state: Disconnected  
    &gt;&gt; notice: Ready to connect.  
  VPN&gt;   &gt;&gt; contacting host (mycompanyvpnsite.com) for login information...  
    &gt;&gt; notice: Contacting mycompanyvpnsite.com.  
  VPN&gt;  
    &gt;&gt; Please enter your username and password.  
  
  Username: [myusername] Password:  
  </code></pre>
  
  <p>Username myusername which it is showing is cached from my previous manual logins. So it appears that this run did not take any values from the login.txt.<br>
   If I had executed my vpn.bat alone without any params, i get prompt like this</p>
  
  <pre><code>VPN&gt;  
    &gt;&gt; Please enter your username and password.  
  
  Username: [myusername] &lt;i press enter to take the cached value&gt;  
  Password: ******** &lt;i enter password and press enter&gt;  
  </code></pre>
  
  <p>and it connects.  </p>
  
  <p>The vpn client does not have privilege to specify password on command line, that's why I am trying this way.  </p>