Change the process name in the task manager

I have a windows application running on a server. Now I need to have several instances of the same application at the same time. Each instance connects to a different database. When the application starts, I change the title so that I can determine which database is connecting to, but I would also like to change the name in the task manager. This is because I have another application that acts as a supervisor, killing and starting the process as necessary. I have to find a way to clearly identify the process to kill.

+6
source share
2 answers

Ask your supervisor to create a temporary copy of the executable, including your identifying information, and run this ... so that the task manager looks like

My process - database 1.exe My process - database 2.exe et cetera 
+1
source

If the Supervisor program is the one that runs the processes, you will have full control over these child processes. You can easily kill / launch them as needed. Use Process as needed.

 using System.Diagnostics; Process p1 = new Process(); Process p2 = new Process(); Process p3 = new Process(); p1.StartInfo.FileName = "notepad.exe"; p2.StartInfo.FileName = "notepad.exe"; p3.StartInfo.FileName = "notepad.exe"; //start the procs p1.Start(); p2.Start(); p3.Start(); //kill the procs p1.Kill(); p2.Kill(); p3.Kill(); 

If you want a superuser to have access to this process, why not let them just do it using a graphical interface? If there is no GUI, how do they run the program? Is it started via cmd?

Copied from my comment below:

If the user wants to be able to kill the process directly from the task manager, he can use the application tab to select the correct process (you will need to give him a unique window title), then they can right-click> Go Process and kill from there.

0
source

All Articles