Solved

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

Posted on 2011-02-15
4
408 Views
Last Modified: 2012-06-21
When the copy is complete , the progress bar should dissapear.
How can I impliment this ?
0
Comment
Question by:itbabe
  • 2
4 Comments
 
LVL 11

Expert Comment

by:Tasmant
ID: 34895505
VBScript and progress bar are a pain.
You could do better and easier with Powershell and the cmdlet write-progress
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 34895635
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
 

Author Comment

by:itbabe
ID: 34896271
Can I also disable the cancel button ?
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 500 total points
ID: 34900777
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now