?
Solved

VBS multiple copy processes

Posted on 2013-06-24
8
Medium Priority
?
332 Views
Last Modified: 2013-07-01
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?
0
Comment
Question by:tomdenton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 46

Expert Comment

by:aikimark
ID: 39276687
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.
0
 

Author Comment

by:tomdenton
ID: 39289981
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
0
 
LVL 46

Expert Comment

by:aikimark
ID: 39290184
open a command prompt window and type:
Help Start

Note: as with most commands, you can also get the help text with Start /?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tomdenton
ID: 39290382
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("WSCript.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("WSCript.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...
0
 
LVL 46

Accepted Solution

by:
aikimark earned 2000 total points
ID: 39290915
The oShell.Run method does the same thing as the Start command.  As long as you don't include the wait-for-completion = True parameter, you will be able to spawn several processes.

However, the nice thing about the Start parameter is that it has an AFFINITY parameter that allows you to direct the newly spawned task to a particular CPU.
0
 

Author Closing Comment

by:tomdenton
ID: 39291021
Many thanks, when I have put all the code together I will share it here for others to use.

I appreciate your help
Tom
0
 
LVL 46

Expert Comment

by:aikimark
ID: 39291132
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.
0
 

Author Comment

by:tomdenton
ID: 39291548
Will do, thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

765 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