title: Running Powershell script with spaces in path from VBS
body: <p>Can someone help with this script please? Basically, it's being ran by vbs and the options are set for each user running the script.</p>
  
  <p>The script works as is on machines that support the dos 8.3 file system, but we also have quite a few imaged systems and do not have this ability...</p>
  
  <p>So i'm fruitlessly trying to get the machines that do not support 8.3 to run this. Powershell does not like the space in the file path..., and I'm trying to run the script silently.</p>
  
  <pre><code>Objshell.Run "powershell.exe (gc c:\users\$env:USERNAME\Mydocu~1\Canadi~1\FileImportSettings.config) -replace 'temp','server\blahblah' | out-file c:\users\$env:USERNAME\Mydocu~1\Canadi~1\FileImportSettings.config",0
  </code></pre>
  
  <p>The comment was coming messy so I'm posting it further on to the original post..</p>
  
  <p>What I had posted initially was part ofmy attempt at fixing the problem and it wouldn't run. This edited one does... But when I try changing it to doublequotes, the code no longer changes the username to %username%. I've tried running the command directly and cmd complains that out-file is not a recognised valid command.</p>
  
  <pre><code>Wscript.echo "powershell.exe (gc ""c:\users\""$env:USERNAME""\Documents\Canadian...\FileImportSettings.config"") -replace 'temp','server\blahblah' | out-file ""c:\users\""$env:USERNAME""\Documents\Canadian....\FileImportSettings.config""",0
  </code></pre>