title: Running multiple commands in cmd via psexec
body: <p>I'm working on creating a single command that will run mulitple things on the command line of another machine. Here is what I'm looking to do.</p>
  
  <ul>
  <li>Use psexec to access remote machine</li>
  <li>travel to proper directory and file</li>
  <li>execute ant task</li>
  <li>exit cmd</li>
  <li>run together in one line</li>
  </ul>
  
  <p>I can run the below command from Run to complete what I need accomplished but can't seem to get the format correct for psexec to understand it.</p>
  
  <pre><code>cmd /K cd /d D:\directory &amp; ant &amp; exit
  </code></pre>
  
  <p>I've tried appling this to the psexec example below:</p>
  
  <pre><code>psexec \\machine cmd /K cd /d D:\directory &amp; ant &amp; exit 
  </code></pre>
  
  <p>When executing this it will activate the command line and travel to <code>D:\directory</code> but won't execute the remaining commands.  Adding <code>""</code> just creates more issues.</p>
  
  <p>Can anyone guide me to the correct format? Or something other than psexec I can use to complete this (free options only)?</p>