title: Is it possible to run a command headlessly (in a bat script) as another user on Windows?
body: <p>I want to have a .bat script do a particular task as a different user and run headlessly (no user input or prompting is allowed).  Is there a way to do this with a .bat script?  Please note that I am constrained to not use PowerShell as it not installed by default on all of the Windows operating systems that we must support.</p>
  
  <p>I have considered <strong>RUNAS</strong> in my script, but it apparently requires interactive input.</p>
  
  <p>In Linux, the equivalent idiom is:</p>
  
  <pre><code>echo "Password" | sudo -S -u username "command"
  </code></pre>
  
  <p>Any suggestions for Windows .bat scripts?</p>
  
  <p>Update: I believe that <strong>vbscript</strong> is always available on Windows, so if a purely headless solution is available via vbscript, then that is good, too!</p>