title: Running remote batch file with PsExec and C#
body: <p>I'm trying to run a remote batch file - already located on the remote machine - using PsExec, called via Process in C#. I've confirmed that all required files already exist, but believe I may have a problem with my syntax, as the redirected output indicates that it can't find the file specified.</p>
  
  <p>The machine against which PsExec runs is dynamic, which is the myArray[0].MachineName value (this pulls in without issue).</p>
  
  <pre><code>wsStopProcess.StartInfo.FileName = @"C:\Windows\system32\PsExec.exe";
  wsStopProcess.StartInfo.Arguments = @" \\" + myArray[0].MachineName + @"D:\stopprofile.bat";
  
  wsStopProcess.StartInfo.UseShellExecute = false;
  wsStopProcess.StartInfo.CreateNoWindow = true;
  wsStopProcess.StartInfo.RedirectStandardOutput = true;
  wsStopProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
  
  wsStopProcess.Start(); 
  </code></pre>
  
  <p>Any ideas on what appears to be formatted incorrectly? I'm guessing it's too many backslashes (or not enough!) somewhere.   </p>