title: Vbs CopyFile to User Selected Folder is not working properly
body: <p>My Vbscript is for prompt to select a folder and then copy a file to the seleted folder
  My Code is:</p>
  
  <pre><code>Option Explicit
  Dim strPath, pth, fso
  
  strPath = SelectFolder( "" )
  pth = """" &amp; strPath &amp; "\" &amp; """"
  
  If strPath = vbNull Then
    WScript.Echo "Cancelled"
  Else
    Set fso = CreateObject("Scripting.FileSystemObject")
  
  fso.CopyFile "H:\new\file.txt", strPath
  
  ' fso.CopyFile "H:\new\file.txt", pth
  
  msgbox("Copy DONE")
  End If
  
  
  Function SelectFolder( myStartFolder )
  
  Dim objFolder, objItem, objShell
  
  On Error Resume Next
  SelectFolder = vbNull
  
  Set objShell  = CreateObject( "Shell.Application" )
  Set objFolder = objShell.BrowseForFolder( 0, "Select Folder Please", 0, myStartFolder )
  
  If IsObject( objfolder ) Then SelectFolder = objFolder.Self.Path
  
  Set objFolder = Nothing
  Set objshell  = Nothing
  On Error Goto 0
  End Function
  </code></pre>
  
  <p>When i am using <b>fso.CopyFile "H:\new\file.txt", strPath </b> it only copies to the path if the path is like <b>c:\ or d:\ </b> but does not copying file to like '<b>d:\folder\test\</b>' if selected, it showing error - " <b>PERMISSON DENIED </b>", but the path has not set any attribute</p>
  
  <p>When i am using <b>fso.CopyFile "H:\new\file.txt", pth </b> , it showing error - " <b>Bad File Name or Number </b>" for any folder selection</p>
  
  <p>what should i do? Please Help</p>