title: Permission denied on CopyFile in VBS
body: <p>I'm trying to automate pushing a file into my users' home directories, but am stuck on a "Permission Denied" error — is thrown on line 6 here, with the CopyFile call.</p>
  
  <p>There are other parts of the script (not shown) that create and copy folder contents using the same source and destination directories, and they work perfectly. It's only when I use CopyFile that it fails.</p>
  
  <pre><code>Dim fso
  
  Set fso = CreateObject("Scripting.FileSystemObject")
  
  If Not fso.FileExists("H:\Minecraft\.minecraft\options.txt") Then
      fso.CopyFile "C:\Minecraft\options.txt", "H:\Minecraft\.minecraft\"
  End If
  
  Set fso = Nothing
  </code></pre>
  
  <p><code>H:</code> is a network home directory, to which the current user has full read/write privs.</p>
  
  <p>I've tried adding/removing trailing slashes from the paths, adding <code>"options.txt"</code> to the destination path, removing the <code>false</code> argument... Not sure what else to try. Any thoughts?</p>
  
  <p>FYI, this chunk of code, which comes immediately before the error-prone bit above, executes perfectly every time:</p>
  
  <pre><code>If Not fso.FolderExists("H:\Minecraft\.minecraft\bin\") Then
      If Not fso.FolderExists("H:\Minecraft\.minecraft\") Then
          fso.CreateFolder("H:\Minecraft\.minecraft\")
      End If
      fso.GetFolder("C:\Minecraft\bin\").Copy "H:\Minecraft\.minecraft\"
  End If
  </code></pre>