• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1056
  • Last Modified:

Using System.Diagnostics.Process.Start

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
newcomguy
Asked:
newcomguy
  • 3
2 Solutions
 
thenrichCommented:
Why not use shell?
Shell("C:/Application.exe")
0
 
thenrichCommented:
Why do you have:
myProcess.WaitForExit()

That maybe your problem
0
 
KGregCommented:
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
 
newcomguyAuthor Commented:
How would you recommend spawning a new thread for each process?
0
 
thenrichCommented:
Just the way you are doing just get rid of the 'waitforexit' code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now