[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
  • No one is chatting at the moment.
  • Chat Bot:
    ANGUS0023233 has joined the room.
  • Chat Bot:
    56HoursMaga is our newest member. Welcome!
  • Chat Bot:
    gavangtvvcc1 is our newest member. Welcome!
  • Chat Bot:
    QM|T has joined the room.
  • Chat Bot:
    qs88qhcom is our newest member. Welcome!
  • Chat Bot:
    QM|T has joined the room.
  • Chat Bot:
    789winckorg2 is our newest member. Welcome!
  • Chat Bot:
    theplanetclickernet2 is our newest member. Welcome!
  • Chat Bot:
    Passive Samurai is our newest member. Welcome!
  • Chat Bot:
    Trm is our newest member. Welcome!
  • Chat Bot:
    xoilac21com is our newest member. Welcome!
  • Chat Bot:
    vipwin101com is our newest member. Welcome!
  • Chat Bot:
    f8beta2ink2 is our newest member. Welcome!
  • Chat Bot:
    bixx88com is our newest member. Welcome!
  • Chat Bot:
    new88t2net18 is our newest member. Welcome!
  • Chat Bot:
    QM|T has joined the room.
  • Chat Bot:
    Jikiyu is our newest member. Welcome!
  • Chat Bot:
    78windcomm is our newest member. Welcome!
  • Chat Bot:
    Kskskjsnx is our newest member. Welcome!
  • Chat Bot:
    Kskskjsnx has posted a new reply in the thread "Console ID #8668".
  • Chat Bot:
    Kskskjsnx has posted a new reply in the thread "Console ID #8668".
  • Chat Bot:
    og starboy has left the room.
  • Chat Bot:
    78win01bet2 is our newest member. Welcome!
  • Chat Bot:
    mihebghqbi is our newest member. Welcome!
  • Chat Bot:
    QM|T has joined the room.
      Chat Bot: QM|T has joined the room.