|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
running application using vb.netHi,
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() 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() > > "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/> 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/> 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/> 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() > > 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() > > > > > >
Replace Selected Text
printing problem with dotmatrix printer using vb.net Different Approaches to Saving settings: Which is better? Properties of a Property Treeview drives me crazy! Data Types and structure Memory Usage? Windows XP Style How to load hierarchical Db data in treeview?? Deleting configurations Activating Windows Forms |
|||||||||||||||||||||||