© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
70 replies
Mek

✅ Closing first terminal, opening second terminal

// in file A
var p = new Process();
p.StartInfo.FileName = "test.exe";
p.Start();

// in file B
var p = new Process();
p.StartInfo.FileName = "main_app.exe";
p.Start();
// in file A
var p = new Process();
p.StartInfo.FileName = "test.exe";
p.Start();

// in file B
var p = new Process();
p.StartInfo.FileName = "main_app.exe";
p.Start();

My main program in
main_app.exe
main_app.exe
. When I run my main program, it opens in terminal 1 as expected. When
main_app.exe
main_app.exe
runs the new process to start a second program, I would like for that second program to open in a new terminal (terminal 2) and the terminal (terminal 1) to be closed. So close current terminal, open new terminal. Then when the second program finishes it's process and relaunches
main_app.exe
main_app.exe
, I would like for terminal 2 to close, and a new terminal (terminal 3) to open. How would I accomplish this?

TL:DR
1.
main_app.exe
main_app.exe
=> terminal 1
2.
test.exe
test.exe
=> terminal 2
3. terminal 1 finishes work, opens terminal 2, closes terminal 1
4. terminal 2 finishes work, opens terminal 3, closes terminal 2
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

✅ closing/opening form on spesific button (togeling button)
C#CC# / help
2y ago
How to put VS Code integrated terminal into my second monitor?
C#CC# / help
2y ago