-1

my method...

private static void RunAndExit(string command)
{
    var processInfo = new ProcessStartInfo
    {
        FileName = "cmd.exe",
        Arguments = "/c " + command,
        CreateNoWindow = false,
        UseShellExecute = true,
        RedirectStandardError = false,
        RedirectStandardOutput = false
     };
    }

I want the process started by RunAndExit() to continue to run after the app containing this method has exited. Thanks for any help!

user3574948
  • 31
  • 1
  • 4

1 Answers1

3

Your code will already achieve that, so long as you actually start the new process. You are missing a call to Process.Start().

private static void RunAndExit(string command)
{
    var processInfo = new ProcessStartInfo
    {
        FileName = "cmd.exe",
        ....
    };
    Process.Start(processInfo); // add this line
}
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490