C
C#5mo ago
natxnek

Thread when starting a process

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "discordbotloader.exe";
process.StartInfo.Arguments = "-bot";
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
process.Start();
process.WaitForExit();
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "discordbotloader.exe";
process.StartInfo.Arguments = "-bot";
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
process.Start();
process.WaitForExit();
is there a way to make that process run in the background when i close the application that started the process? if i close the main console app, it also closes the new process
6 Replies
natxnek
natxnekOP5mo ago
like it creates a new process under the original process how can i avoid that
Angius
Angius5mo ago
You're looking for a service worker, probably
natxnek
natxnekOP5mo ago
nvm fixed it, i used process.StartInfo.UseShellExecute = true;
Angius
Angius5mo ago
Ah, duh, my bad I thought you're trying to create a separate task from the same code, completely missed that you're running something else. Makes sense
natxnek
natxnekOP5mo ago
well, i am technically running the same exe
Omnissiah
Omnissiah5mo ago
(so that would be a detached process)
Want results from more Discord servers?
Add your server