Solved

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

Posted on 2011-02-15
4
410 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

828 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