473,387 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

running application using vb.net

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()
Feb 17 '06 #1
6 2487
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()

Feb 17 '06 #2
"Lynn" <Ma*******@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/>
Feb 17 '06 #3
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" <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()

Feb 17 '06 #4
thanks so much

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
"Lynn" <Ma*******@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/>

Feb 17 '06 #5
how can i verify that all files and folders are copied successfully from the
source ?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
"Lynn" <Ma*******@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/>

Feb 17 '06 #6
is there any way that i can automate the checking instead of running the
command again manually?

"AMDRIT" <am****@hotmail.com> wrote in message
news:u1**************@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" <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()


Feb 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: BK | last post by:
Can someone point me to a code sample that illustrates executing long running tasks (asynchronous) from a web application in ASP.NET? I assume that Web Services might come into play at some point,...
2
by: Tim Diggle | last post by:
I'm trying to enter data into a database application running under Citrix ICA Client. I'm doing it from a VBA macro running under Microsoft Excel 2000 (although it may need to be backwardly...
3
by: BobAchgill | last post by:
I am using FTP built in to my application to update the application and data from a server... What is the normal method folks use to over write the application while the program is active? What...
8
by: Nate | last post by:
I am running on Window 2003. I have a website built in ASP.NET 2.0. I need to have a Virtual Directory running an application in 1.1. I have configured each in its own Application Pool. The 1.1...
2
by: anonieko | last post by:
Avoid running several simultaneous instances of the same application on a single machine. ( Checking if application is already running) (Book Excerpt Practical C#2) Thanks to the static...
3
by: Michel | last post by:
Hi, I wrote an app in .Net and I whant only 1 instance of this app open for the user; the user open my app, do some works and try to open another instance of my app, I whant to show a message to...
5
by: plmanikandan | last post by:
Hi, I have written a win32 console application(exname1.exe) which runs for ten minutes.I am calling this exname1.exe from another exe named exname.exe using shellexecuteex.Now from exname.exe...
4
by: news.citenet.net | last post by:
I keep getting the following error message after my web site running 2 or 3 days I share one folder with about 200 domain names Any one can help? ...
3
by: Anil Kumar Sharma | last post by:
Hello, I am working on C# using vs.net 2003. I have faced two interesting problems. 1. Dynamically setting Default Button: I created a form and used it in various contexts. On basis of the...
1
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.