Diskpart in multi-task environment

Hi all,

This topic is a little bit off-theme, but nevertheless related to Xojo.
For a pendrives duplication software, I need to erase and format pendrives with 2 or more partitions.
Given that a Shell Format command will only format the designed volume (or partition), I’m trying to use diskpart and I’m facing an issue: diskpart seems to not be compatible with multi-task environment based on Master/Slaves principle.

What I’m doing is:

  • The Master App calls a Slave one, passing needed parameters through IPCSocket (this works fine),
  • The Slave App gets parameters, creates a script and calls diskpart in an asynchronous shell (dispart /s myscript.txt). This works fine, too, with one or two slaves in the same time,
  • Where I get some difficulties is when I try to format 3 or more pendrives, running 3 or more Slave Apps and, though, 3 or more instances of diskpart.

Doing the same with Robocopy (for files copy) works like a charm.
Does diskpart not accept working with multiple instances? Or should I do something special?
Eventually, is there another way to format disks instead of volumes (I know it’s possible using DeviceIOControl calls, but I didn’t achieve to write this code).

Many thanks in advance for any advice/help.