Solved

Using System.Diagnostics.Process.Start

Posted on 2004-10-06
5
1,037 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 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

9 Experts available now in Live!

Get 1:1 Help Now