Jump to content
Sign in to follow this  

Progress bar for file copying

Recommended Posts


is there a way to set a progress bar for DirCopy or FileCopy?

Share this post

Link to post
Share on other sites

search "Scripts & Scraps" there are LOTS of them



Share this post

Link to post
Share on other sites

sorry about posting vbScript code here, but it is easily converted to autoit.

As the newer version of autoit can use com objects, it ought to be able

to use "Shell.Automation".

The point of this example is that it will use the same system capabilities

as when you copy files using the system (context menu), and you will

get the same system dialog with the progressbar and animation

(that is, those pieces of paper flying through the air).

One caution, with the system dialog, the copy operation must take long

enough for the dialog to show and the animaton "to develop". Otherwise

you won't see anything.

' script to demo shell.application 
Option Explicit
Dim oSHApp  ' as object
Dim sSrc, sDest  ' as string
Const FOF_SIMPLEPROGRESS = 256 '(&H100)

Set oSHApp = CreateObject("Shell.Application")

  sSrc = "c:\windows\temp\*.*"
  sDest = "A:\"

  ' use ms Animated Copy Applet, showing names and progressbar...
  oSHApp.Namespace(sDest).CopyHere sSrc

  ' use ms Animated Copy Applet, showing progressbar (but no names)...
  oSHApp.Namespace(sDest).CopyHere sSrc, FOF_SIMPLEPROGRESS

Set oSHApp = nothing  ' clean up

If you want to take this one level deeper, then you can use the

system api directly. Go to msdn, and read up on the SHFileOperation

api, and its associated SHFILEOPSTRUCT typedef.

When you use the api, you get the same system dialog, progbar

and animation you get with the Shell.App "CopyHere" method.

Also the same caveat applies, if the copy doesn't take very long

you won't ever see the dialog. But then, the only reason to show

a progressbar anyway is to give users something to watch during

a lengthy copy operation.

cheers, jw

Share this post

Link to post
Share on other sites

is it me or does it not support directory or multiply file copys?

Share this post

Link to post
Share on other sites

Search the forum...the one I posted does directories, multiple files, moving files, deleting files, etc. See here.


Edited by livewire

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.