By default, a console C# app will hold the command-prompt until the app exits. Is there a setting in the .NET framework that will cause the command-prompt to return immediately This is sort of analogous to running a command in the background in unix by appending & to the command.

command prompt return immediately when running console application
Elliot Rodriguez
Just return the Main method and your program will exit.
Vyanki
If the process writes to the standart output stream, you can read it with the code i gave. I don't understand your problem with 'prompt back immediately', you want to continue the process on the background and start the next one or do you want to wait till the started process is finished and then start the next one
Darren Dmello
themicks
it works. two things: you need to create a second app (launcher) and as far as I tried the app wasn't able to produce any console output. but if no need of console output, I agree with PJ. van de Sande about, develop a service that will run in the background.
regards.
Florida Keys Coder
can you specify those apps or give some examples what is the output of those apps what do those apps do maybe you get the prompt back immediately because those apps you are running have a short live because they do small tasks but as far as I know it is not possible to run various command-line apps at the same time from the same console as if it were unix.
regards.
Mark Ipoeng
Hi. The responsables of doing that are the shell and the OS not the C# language or the .Net framework. The OS because it must support Multitaksing (ms-dos does not) and the shell because it must do some system calls, ex fork (not exists in ms-dos) and exec, in order to provide that functionality.
Regards.
Ed Hintz
I will close this one, so we don't gonne discusse this on multiple places.
-- sam --
omerkaan
ProcessStartInfo startinfo = new ProcessStartInfo( @"c:\myapp.exe" );
startinfo.WindowStyle = ProcessWindowStyle.Hidden;
startinfo.RedirectStandardOutput = true;
Process process = Process.Start( startinfo );
process.WaitForExit();
using( StreamReader reader = process.StandardOutput )
{
Console.WriteLine( "Output of started process:\r\n" + reader.ReadToEnd() );
}
ecomajor
Thanks I'll try your method of creating a launcher app. But actually, it's not so much that I wanted my app to work in the background, but rather i wanted the convenience of getting the prompt back immediately so I can continue entering other commands.
I guess I'm more used to traditional winapi development where if you created a windows application, you couldn't write output to the console and you would get the prompt back immediately. is it different with managed applications i noticed that with C# apps, you have the best of both worlds, you can display a GUI and also write to the console. is the reason why we don't get the prompt back immediately because the app can write to the console
is there a way to get the prompt back w/o a launcher app
navisoft
ProcessStartInfo startinfo = new ProcessStartInfo( @"c:\myapp.exe" );
startinfo.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start( startinfo )
kmtracker