This line: Process.GetCurrentProcess.WaitForExit() is waiting for your
application to end, not the process. So that causes the app to hang.
Assuming you have a reason for not using the built-in File.Copy() function,
try this code.
Dim MyProcess as New Process
Dim psi as New ProcessStartInfo()
psi.FileName="xcopy"
psi.Arguments="c:\abc d:\abc"
MyProcess.ProcessStartInfo=psi
MyProcess.Start()
MyProcess.WaitForExit()
"Lynn" <Ma*******@yah00.c0m> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
Hi,
I use the following code to run xcopy, but my application hangs after the
copying has finished. What could be wrong?
Dim psi As New ProcessStartInfo()
psi.FileName = "xcopy"
psi.Arguments = "c:\abc d:\abc"
Process.Start(psi)
Process.GetCurrentProcess.WaitForExit()