Solved

Using System.Diagnostics.Process.Start

Posted on 2004-10-06
5
1,043 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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