Process termination
-
Hi , two notepad are running one is saved as first.txt other is saved as second.txt how to kill only one process first.txt I am using the following code which is closing all the notepad
foreach (Process pre in Process.GetProcesses())
{if (pre.ProcessName.StartsWith("notepad")) { pre.Kill(); } }
Regards, Amit Patel
-
Hi , two notepad are running one is saved as first.txt other is saved as second.txt how to kill only one process first.txt I am using the following code which is closing all the notepad
foreach (Process pre in Process.GetProcesses())
{if (pre.ProcessName.StartsWith("notepad")) { pre.Kill(); } }
Regards, Amit Patel
Find the main window of the process first, next get the caption of window, check your condition, if it's satisfy then kill that process...
-
Hi , two notepad are running one is saved as first.txt other is saved as second.txt how to kill only one process first.txt I am using the following code which is closing all the notepad
foreach (Process pre in Process.GetProcesses())
{if (pre.ProcessName.StartsWith("notepad")) { pre.Kill(); } }
Regards, Amit Patel
-
Hi , two notepad are running one is saved as first.txt other is saved as second.txt how to kill only one process first.txt I am using the following code which is closing all the notepad
foreach (Process pre in Process.GetProcesses())
{if (pre.ProcessName.StartsWith("notepad")) { pre.Kill(); } }
Regards, Amit Patel
what about this
Process[] pro = Process.GetProcessesByName("Notepad");
pro[0].Kill(); -
what about this
Process[] pro = Process.GetProcessesByName("Notepad");
pro[0].Kill(); -