X-Ecutioner Posted September 9, 2008 Share Posted September 9, 2008 Okay, so I created this VBS file that executes at RunonceEx after XP installs. It copies all the files from the installation source (dynamically gets the source location from the reg key "SourcePath") to C:\Windows\Cabs.Option ExplicitDim WSHShell, RegKey, Sourcepath, Result, fsoSet WSHShell = CreateObject("WScript.Shell")Set fso = CreateObject("Scripting.FileSystemObject")RegKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\"Sourcepath = WSHShell.RegRead (regkey & "SourcePath")fso.CreateFolder("c:\Windows\Cabs")fso.CopyFolder Sourcepath & "*", "c:\Windows\Cabs\",TRUEWSHShell.RegWrite regkey & "Sourcepath", "C:\Windows\Cabs", "REG_SZ"WSHShell.RegWrite regkey & "ServicePackSourcepath", "C:\Windows\Cabs", "REG_SZ"When this runs, all I see is a cmd prompt...then it goes away when its done.What I need help with is how to get a Progress Bar to display the file copy process so you have an idea how much time is left.Any thoughts? Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 9, 2008 Share Posted September 9, 2008 You need to use a different object in the script that allow for the progress bar.Here is your script with some changes made. I have not tested this script.Save As CopySource.vbsOption ExplicitConst FOF_CREATEPROGRESSDLG = &H0&Dim Act :Set Act = CreateObject("WScript.Shell")Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Shl :Set Shl = CreateObject("Shell.Application")Dim Folder, RegKey, Sourcepath RegKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\" Sourcepath = Act.RegRead(RegKey & "SourcePath") If Not Fso.FolderExists("c:\Windows\Cabs") Then Fso.CreateFolder("c:\Windows\Cabs") Set Folder = Shl.NameSpace(Sourcepath) Folder.CopyHere "c:\Windows\Cabs\", FOF_CREATEPROGRESSDLG Act.RegWrite regkey & "Sourcepath", "C:\Windows\Cabs", "REG_SZ" Act.RegWrite regkey & "ServicePackSourcepath", "C:\Windows\Cabs", "REG_SZ" Link to comment Share on other sites More sharing options...
X-Ecutioner Posted September 15, 2008 Author Share Posted September 15, 2008 I'll give it a go... thanks a lot! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now