Home All Groups Group Topic Archive Search About

running application using vb.net

Author
17 Feb 2006 1:07 PM
Lynn
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()

Author
17 Feb 2006 1:52 PM
Terry Olsen
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()

Show quoteHide quote
"Lynn" <MarryLynn@yah00.c0m> wrote in message
news:OBv02K8MGHA.3164@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()
>
>
Author
17 Feb 2006 2:32 PM
Herfried K. Wagner [MVP]
"Lynn" <MarryLynn@yah00.c0m> schrieb:
> 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()

\\\
Dim p As Process = Process.Start("xcopy", "C:\abc D:\abc")
p.WaitForExit()
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
17 Feb 2006 3:44 PM
Lynn
thanks so much

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uS0Pz78MGHA.3888@TK2MSFTNGP12.phx.gbl...
> "Lynn" <MarryLynn@yah00.c0m> schrieb:
> > 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()
>
> \\\
> Dim p As Process = Process.Start("xcopy", "C:\abc D:\abc")
> p.WaitForExit()
> ///
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
Author
17 Feb 2006 3:50 PM
Lynn
how can i verify that all files and folders are copied successfully from the
source ?

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uS0Pz78MGHA.3888@TK2MSFTNGP12.phx.gbl...
> "Lynn" <MarryLynn@yah00.c0m> schrieb:
> > 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()
>
> \\\
> Dim p As Process = Process.Start("xcopy", "C:\abc D:\abc")
> p.WaitForExit()
> ///
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
Author
17 Feb 2006 3:35 PM
AMDRIT
Run the command in the commandwindow.  I wonder if you are being prompted to
overwrite a file.

You realize that with a few more lines of code, you can replicate your own
xcopy routine using system.io namespace?


Show quoteHide quote
"Lynn" <MarryLynn@yah00.c0m> wrote in message
news:OBv02K8MGHA.3164@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()
>
>
Author
17 Feb 2006 4:09 PM
Lynn
is there any way that i can automate the checking instead of running the
command again manually?

Show quoteHide quote
"AMDRIT" <amd***@hotmail.com> wrote in message
news:u1JbHf9MGHA.3832@tk2msftngp13.phx.gbl...
> Run the command in the commandwindow.  I wonder if you are being prompted
to
> overwrite a file.
>
> You realize that with a few more lines of code, you can replicate your own
> xcopy routine using system.io namespace?
>
>
> "Lynn" <MarryLynn@yah00.c0m> wrote in message
> news:OBv02K8MGHA.3164@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()
> >
> >
>
>