tomdenton
asked on
VBS multiple copy processes
Hi, I think the the answer to this is no, due to the sequential nature of the script - but then you guys have done amazing things for me before so...
I have a vbscript that I compile to exe and run as admin - It checks for all the USB drives in a computer, NTFS formats and names them all, and then allows me to choose a folder once, that then copies to each USB in turn. I am copying almost 5GB to each so it takes a while! It all works fine but as perhaps we would expect, each copy process completes before the next one starts.
Using windows explorer, if I manually drag and drop the files I can set several copy processes running at the same time and this seems to be much faster. Can I make this happen in VBS do you know?
I have a vbscript that I compile to exe and run as admin - It checks for all the USB drives in a computer, NTFS formats and names them all, and then allows me to choose a folder once, that then copies to each USB in turn. I am copying almost 5GB to each so it takes a while! It all works fine but as perhaps we would expect, each copy process completes before the next one starts.
Using windows explorer, if I manually drag and drop the files I can set several copy processes running at the same time and this seems to be much faster. Can I make this happen in VBS do you know?
you want to use the START command to spawn new processes instead of calling each process, which will cause a wait-for-completion. Your choice of source for the copy operation would be done by the parent process and then it would START a process for each destination it finds, passing the source and destination as parameters.
ASKER
Sorry for the delay.
Do you mean process.start as i can't find anything on s specific START command? If it is process.start maybe i could call several instances of xcopy to achieve what i want?
Can you give me an example of what you mean by the START command please?
Thanks
Do you mean process.start as i can't find anything on s specific START command? If it is process.start maybe i could call several instances of xcopy to achieve what i want?
Can you give me an example of what you mean by the START command please?
Thanks
open a command prompt window and type:
Help Start
Note: as with most commands, you can also get the help text with Start /?
Help Start
Note: as with most commands, you can also get the help text with Start /?
ASKER
Ah ok I was working in vbs...
In a command window if I use something like:
start xcopy.exe C:\1 C:\2 /s /e
then it opens a second command window and works fine
But I can't seem to call this from a script. I tried:
Set oShell = WScript.CreateObject("WSCr ipt.shell" )
oShell.run "cmd start xcopy.exe C:\1 C:\2 /s /e"
It opens the command window but does not execute the xcopy - I am sure I am missing something!
Also, to then run more that one copy process would i just use:
Set oShell = WScript.CreateObject("WSCr ipt.shell" )
oShell.run "cmd start xcopy.exe C:\1 C:\2 /s /e"
oShell.run "cmd start xcopy.exe C:\1 C:\3 /s /e"
etc...
In a command window if I use something like:
start xcopy.exe C:\1 C:\2 /s /e
then it opens a second command window and works fine
But I can't seem to call this from a script. I tried:
Set oShell = WScript.CreateObject("WSCr
oShell.run "cmd start xcopy.exe C:\1 C:\2 /s /e"
It opens the command window but does not execute the xcopy - I am sure I am missing something!
Also, to then run more that one copy process would i just use:
Set oShell = WScript.CreateObject("WSCr
oShell.run "cmd start xcopy.exe C:\1 C:\2 /s /e"
oShell.run "cmd start xcopy.exe C:\1 C:\3 /s /e"
etc...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks, when I have put all the code together I will share it here for others to use.
I appreciate your help
Tom
I appreciate your help
Tom
When you are testing, please try and separate these USB devices as much as possible. I've seen people use a series of daisy-chained USB hubs that get saturated quickly.
Also, you should use USB3.0, if your machine has it.
Also, you should use USB3.0, if your machine has it.
ASKER
Will do, thanks