Skip to content

Instantly share code, notes, and snippets.

@RadAd
Created July 12, 2013 05:04
Show Gist options
  • Save RadAd/5981699 to your computer and use it in GitHub Desktop.
Save RadAd/5981699 to your computer and use it in GitHub Desktop.
Copy a file with a visual progress window just like explorer except that it can be used from the command line.
'From http://blogs.technet.com/b/heyscriptingguy/archive/2006/10/10/how-can-i-provide-a-visual-indicator-when-copying-files.aspx
'CopyHere method See http://msdn.microsoft.com/en-us/library/bb787866%28v=VS.85%29.aspx
Const FOF_CREATEPROGRESSDLG = 0
Set oShell = CreateObject("WScript.Shell")
Set objShell = CreateObject("Shell.Application")
If WScript.Arguments.Count > 1 Then
strTargetFolder = WScript.Arguments.Item(1)
Else
strTargetFolder = oShell.CurrentDirectory
End If
Set objFolder = objShell.NameSpace(strTargetFolder)
If objFolder Is Nothing Then
MsgBox "Directory """ + strTargetFolder + """ doesn't exist.", vbOKOnly or vbCritical, "Copy Error"
Else
objFolder.CopyHere WScript.Arguments.Item(0), FOF_CREATEPROGRESSDLG
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment