title: schtasks with Powershell and script with space in argument
body: <p>I want to schedule a Powershell script with an argument that has a space in it with schtasks.exe. (Powershell Version 2, Windows 7). Bearing in mind what I’ve read in this forum I’ve come up with this expression to be entered in the Powershell commandline:</p>
  
  <pre><code>schtasks.exe /create /f /tn "Mytaskname" /tr "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe  -command \`"&amp; \`'D:\myscript.ps1\`' \`'D:\Filename with Space.xml\`'" /SD 08/04/2016 /ST 09:00 /RU domain\username  /RP /SC ONCE
  </code></pre>
  
  <p>Unfortunately  this doesn’nt work. If I schedule the task manually it works showing me the following entries in the task planner: </p>
  
  <p>Programm / script</p>
  
  <pre><code>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
  </code></pre>
  
  <p>Add arguments (optional)</p>
  
  <pre><code>-command "&amp; 'D:\myscript.ps1' ''D:\Filename with Space.xml '"
  </code></pre>
  
  <p>Can anybody help?
  Thanks in advance</p>