[C#] End Processes

  • Hello Guest! Welcome to ConsoleCrunch, to help support our site check out the premium upgrades HERE! to get exclusive access to our hidden content.
  • Unable to load portions of the website...
    If you use an ad blocker addon, you should disable it because it interferes with several elements of the site and blocks more than just adverts.
  • Read Rules Before Posting Post Virus Scans with every program.

Elite_Modz

Active Poster
Retired Staff
Active Member
Console ID Poster
Dec 19, 2014
517
380
133
Crunch
Update 1

Code:
Code:
public static void EndTask(string taskname)
  {
  string processName = taskname;
  foreach (Process process in Process.GetProcessesByName(processName))
  {
  process.Kill();
  }
  }

Code:
Code:
EndTask(notepad);

Notes:
Program needs admin privelages.
Filetypes such as (.exe) are Not Supported
 
Last edited:
Code:
Code:
public static void EndTask(string taskname)
  {
  string processName = taskname;
  Process[] processes = Process.GetProcessesByName(processName);
  foreach (Process process in processes)
  {
  process.Kill();
  }
  }

Code:
Code:
EndTask(notepad);

Notes:
Program needs admin privelages.
You don't need to put .exe at the end of the name.


THANK MATE ;)
 
  • Like
Reactions: Elite_Modz
Update 2:

Code:
Code:
public static void EndTask(string taskname)
  {
  string processName = taskname;
  string fixstring = taskname.Replace(".exe", "");

  if (taskname.Contains(".exe"))
  {
  foreach (Process process in Process.GetProcessesByName(fixstring))
  {
  process.Kill();
  }
  }
  else if (!taskname.Contains(".exe"))
  {
  foreach (Process process in Process.GetProcessesByName(processName))
  {
  process.Kill();
  }
  }
  }

Code:
Code:
EndTask("notepad");

Notes:
Program needs admin privelages
Fixed: Filetypes such as (.exe) are Now Supported
 
Last edited:
Update 2:

Code:
Code:
public static void EndTask(string taskname)
  {
  string processName = taskname;

  if (taskname.Contains(".exe"))
  {
  string fixstring = taskname.Replace(".exe", "");
  Process[] processes = Process.GetProcessesByName(fixstring);
  foreach (Process process in processes)
  {
  process.Kill();
  }
  }
  else if (!taskname.Contains(".exe"))
  {
  Process[] processes2 = Process.GetProcessesByName(processName);
  foreach (Process process in processes2)
  {
  process.Kill();
  }
  }
  else
  {

  }
  }

Code:
Code:
EndTask(notepad);

Notes:
Program needs admin privelages
Fixed: Filetypes such as (.exe) are Now Supported

Most of that is totally unnecessary, you could kill a process in just like 3 lines.
 
Most of that is totally unnecessary, you could kill a process in just like 3 lines.
That's Correct, like so:
Code:
  foreach (Process process in Process.GetProcessesByName("notepad"))
  {
  process.Kill();
  }
 
That's Correct, like so:
Code:
  foreach (Process process in Process.GetProcessesByName("notepad"))
  {
  process.Kill();
  }
So why all the extra code?
 
General chit-chat
Help Users
  • Chat Bot:
    QM|T has joined the room.
  • @ QM|T:
    :weed:
  • Chat Bot:
    c168networkk is our newest member. Welcome!
  • @ lurch6661:
    zap
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    thethaonixsys is our newest member. Welcome!
  • Chat Bot:
    Frnkln is our newest member. Welcome!
  • Chat Bot:
    ssabol1637 is our newest member. Welcome!
  • Chat Bot:
    rebugdex_4.75 has joined the room.
  • Chat Bot:
    QM|T has joined the room.
  • Chat Bot:
    waltni42 is our newest member. Welcome!
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    rr88bvcom is our newest member. Welcome!
  • Chat Bot:
    pam has posted a new reply in the thread "Site upgrade 06/12/2022".
  • Chat Bot:
    8kbet8org is our newest member. Welcome!
  • Chat Bot:
    cakhiazvn is our newest member. Welcome!
  • Chat Bot:
    tintuccoca is our newest member. Welcome!
  • Chat Bot:
    rr88tvcom2 is our newest member. Welcome!
  • Chat Bot:
    sc88plus12 is our newest member. Welcome!
  • Chat Bot:
    Christo has joined the room.
  • Chat Bot:
    rr88iocom1 is our newest member. Welcome!
      Chat Bot: rr88iocom1 is our newest member. Welcome!