diskpart "myScript.txt":
select disk 1 convert dynamic noerr select disk 2 convert dynamic noerr create volume stripe disk=1,2 noerr assign letter=X noerr
.
,
When launched from the command line: diskpart /s myScript.txt works as expected .
However , when launched using win api CreateProcess() both conversion commands work, but when they fall into create volume , it displays:
"The arguments you specified for this command are not valid"
. ,
Now, to make things more interesting:
If the script is run again from CreateProcess () the 2nd time (assuming the disks are now converted, and this gives the correct error for comamnds conversions), when it falls into create volume , it works.
Does it make me think that something is doing with disks and / or executables?
Any point in the right direction is evaluated because it is very confusing. Thank you
STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&si, sizeof(si)); ZeroMemory(&pi, sizeof(pi)); si.cb = sizeof(si); strncpy( command, "diskpart.exe /s myScript.txt", (sizeof(command) - 1) ); CreateProcess( "c:\\WINDOWS\\system32\\diskpart.exe", command, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi ) );
end of original question ________________________________________________________
EDIT:
Updates and additional information:
Added a delay of 15-20 seconds before creating the volume command, anyway, the same error message was received.
Also split the work into two scripts with two calls to CreateProcess (). In the second script, just calling "create a volume" and assign it, it hung for a while, and then returned with "this command cannot be completed at this time" .. or something in effect.
One more note: on the first script, putting them in a dynamic one, it worked about two times slower than when working from the command line.
Perhaps you just need to run it all twice (with errors in the second run), as it worked
EDIT2
2 scripts now work or work when I tried it again. Not sure why this didn't work the first time.