title: Psexec , cmd and batch file
body: <p>I have a batch file named a.bat on a winserver2008 Desktop.</p>
  
  <p>That batch file only write the SessionID (from environment variable) to a local eventlog.</p>
  
  <p>I want to execute it remotely using cmd (otherwise the SessionName doesn't appear).</p>
  
  <p>so I have tried</p>
  
  <pre><code>c:\PsTools\psexec.exe \\&lt;Server&gt; -u test2 -p &lt;Password&gt; -i 2 cmd "c:\Users\test-2\Desktop\a"
  </code></pre>
  
  <p>or</p>
  
  <pre><code>c:\PsTools\psexec.exe \\&lt;server&gt; -u test2 -p &lt;Password&gt; -i 2 "cmd \"c:\Users\test-2\Desktop\a\"";exit
  </code></pre>
  
  <p>all of these just open a terminal on the remote machine but don't execute the batch.</p>
  
  <p>Any ides?</p>
  
  <p>Best Regards,</p>