title: Unable to find file in VBScript
body: <p>The VBE encoder section works (from prior experience but this time around it cannot find the required file. The file is in the <code>%temp%</code> folder so there are spaces in the path but I have used the "" as can be seen in the code. The <code>MsgBox</code> shows the correct file and I can confirm its existence but the code fails when <code>fso.GetFile</code>.</p>
  
  <p>This is part of a larger script that is called with the target file (full path) as the argument. The target file is previously created by the calling script.</p>
  
  <p>Main script (gets called with target file):</p>
  
  <pre><code>Set fso      = CreateObject("Scripting.FileSystemObject")
  Set wshShell = WScript.CreateObject("WScript.Shell")
  textFile     = WScript.Arguments(0)
  GetExtension = fso.GetExtensionName(fso.GetFileName(textFile))
  
  If LCase(GetExtension) = "vbs" Then
      Set oFilesToEncode = WScript.Arguments
      Set oEncoder = CreateObject("Scripting.Encoder")
      For i = 0 To oFilesToEncode.Count - 1
          file = """" &amp; Trim(oFilesToEncode(i)) &amp; """"
          MsgBox file
  
          If fso.FileExists(Left(file, Len(file) - 3) &amp; "vbe") Then fso.DeleteFile(Left(file, Len(file) - 3) &amp; "vbe")
  
          Set oFile   = fso.GetFile(file)
          Set oStream = oFile.OpenAsTextStream(1)
          sSourceFile = oStream.ReadAll
          oStream.Close
  
          sDest        = oEncoder.EncodeScriptFile(".vbs", sSourceFile, 0, "")
          sFileOut     = Left(file, Len(file) - 3) &amp; "vbe"
          Set oEncFile = fso.CreateTextFile(sFileOut)
          oEncFile.Write sDest
          oEncFile.Close
      Next
  End If
  
  WScript.Quit
  </code></pre>
  
  <p>Section of calling script:</p>
  
  <pre><code>Do While fso.FileExists(strTempVBS) = False
  Loop
  
  strKey  = "HKEY_CLASSES_ROOT\Engineers-Toolbox\Multi-Tool\Installed\Path\"
  value    = wshShell.RegRead( strKey )
  arg     = " " &amp; strTempVBS
  running = "C:\Custom\Multi-Tool\Multi-Tool.exe " &amp; """" &amp; arg &amp; """"
  wshShell.Run running, True
  </code></pre>
  
  <p>I have tried using hard coding the path to the exe to get it going, 'value' contains the path to the main script.</p>