Solved

Using System.Diagnostics.Process.Start

Posted on 2004-10-06
5
1,039 Views
Last Modified: 2012-05-05
I have developed a console application that launches a variety of other applications using System.Diagnostics.Process.Start to initiate the process, such as:

Dim myProcess As Process = System.Diagnostics.Process.Start("e:\\app1\\setup.exe")
myProcess.WaitForExit()

For most of the applications it launches, this works fine. However, other applications do not run until immediately after I close the console window. (It will hang indefinitely if I leave it open.) This is not acceptable because, depending on the input given to the program, I may need to spawn other processes before terminating the console app. How can I fix the Process.Start call so these other pesky apps will launch without having to first close the console window?

Thanks in advance for your help.
0
Comment
Question by:newcomguy
  • 3
5 Comments
 
LVL 5

Expert Comment

by:thenrich
ID: 12238498
Why not use shell?
Shell("C:/Application.exe")
0
 
LVL 5

Accepted Solution

by:
thenrich earned 105 total points
ID: 12238538
Why do you have:
myProcess.WaitForExit()

That maybe your problem
0
 
LVL 6

Assisted Solution

by:KGreg
KGreg earned 100 total points
ID: 12239447
you hve to get rid of waitforexit, or create a new thread for each process.  wait for exit locks the current thread until the process calling it is killed.

KGREG
0
 
LVL 1

Author Comment

by:newcomguy
ID: 12241748
How would you recommend spawning a new thread for each process?
0
 
LVL 5

Expert Comment

by:thenrich
ID: 12241767
Just the way you are doing just get rid of the 'waitforexit' code.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now