I need a vbscript that can show a progress bar when copying a folder

When the copy is complete , the progress bar should dissapear.
How can I impliment this ?
itbabeAsked:
Who is Participating?
 
RobSampsonCommented:
You can use the progress bar when copying a file with this code.

Regards,

Rob.
strFile = "C:\Temp\MyFile.txt"
strDestination = "C:\Temp\DestinationFolder"
Const FOF_CREATEPROGRESSDLG = &H10&
Set objShell = CreateObject("Shell.Application")
Set objTargetFolder = objShell.NameSpace(strDestination)
If Not objTargetFolder Is Nothing Then
	objTargetFolder.CopyHere strFile, FOF_CREATEPROGRESSDLG
End If

Open in new window

0
 
TasmantCommented:
VBScript and progress bar are a pain.
You could do better and easier with Powershell and the cmdlet write-progress
0
 
itbabeAuthor Commented:
Can I also disable the cancel button ?
0
 
RobSampsonCommented:
Not that I know of.  It's a system dialog, which you cannot customise.

I haven't tested it, but maybe try changing this:
Const FOF_CREATEPROGRESSDLG = &H10&

to this
Const FOF_CREATEPROGRESSDLG = &H110&

Regards,

Rob.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.