VB.NET:
Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim tmp As String() = CStr(e.Argument).Split("?"c)
Dim folder1 As String = tmp(0)
Dim folder2 As String = tmp(1)
Dim procInfo As New ProcessStartInfo
With procInfo
.FileName = "xcopy"
.Arguments = folder1 & " " & folder2 & " /c /d /e /h /i /k /q /r /s /x /y"
.CreateNoWindow = True
.UseShellExecute = False
End With
Dim proc As Process = Process.Start(procInfo)
Do While Not proc.HasExited
If BackgroundWorker1.CancellationPending Then
proc.Kill()
End If
Loop
End Sub
The two folder strings look OK
I've tried a few things but the above code always shows proc.HasExited as True.
What am I doing wrong?
Last edited by a moderator: