title: Run a .cmd file through PowerShell
body: <p>I am trying to run a .cmd file on a remote server with PowerShell.</p>
  
  <p>In my .ps1 script I have tried this:</p>
  
  <pre><code>C:\MyDirectory\MyCommand.cmd
  </code></pre>
  
  <p>It results in this error:</p>
  
  <pre><code>C:\MyDirectory\MyCommand.cmd is not recognized as the name of a cmdlet,
  function, script file, or operable program.
  </code></pre>
  
  <p>And this</p>
  
  <pre><code>Invoke-Command C:\MyDirectory\MyCommand.cmd
  </code></pre>
  
  <p>results in this error:</p>
  
  <pre><code>Invoke-Command : Parameter set cannot be resolved using the specified named
  parameters.
  </code></pre>
  
  <p>I do not need to pass any parameters to the PowerShell script. What is the correct syntax that I am looking for?</p>