.cmd has the following lines
Start ROBOCOY src dest a* b* c* /z /w:1 r:1 Start ROBOCOY src dest d* e* f* g* /z /w:1 r:1 Start ROBOCOY src dest h* K* P* Y* /z /w:1 r:1 Start ROBOCOY src dest xry* srp* /z /w:1 r:1
When I run> Robocopy sample.cmd I start by copying the files 4 times at the same time according to the commands above, it waits for another file, since it has a timeout if the file is used by another process. More faster as it does the job at the same time.
Now I am developing a GUI using C # windows to start the process and then for the management console and
start
main() { process.start( "path of sample.cmd" ) process.waitforexit() label.text=" sucessful copy" }
However, if it takes control of one process, that is cmd.exe, and there are 4 robocopy processes in the task manager. when the cmd.exe process terminates, it returns the cursor to label.text "Sucesssfully completed". While robocopy processes are still in progress, you can see robocopy windows performing the copy process.
Here's the question: I want to take control of all processes (cmd.exe and robocopy.exe) programmatically in C #, so that when label.text should only display “successfully completed” when all commands completed successfully, “if one fails, then the graphical interface makes no sense.
option 2 (similar to Biju, written above): is it better to delete scripts of robocopy commands from sample.cmd (batch file) and write code to run 4 lines of robocopy in C #, but how to run robocooy script a written .cmd file, since they have there are arguments. Since the code starts each robocopy process, each of them will return to the next line of code, and if this fails, we can catch the error and appear in the message box.
Hope this helps ... However, I am looking for a better way if someone can improve the same.
Kishor h swal
source share