static class Module1
{
public static void Main()
{
System.Diagnostics.Process p = default(System.Diagnostics.Process);
foreach (var p in System.Diagnostics.Process.GetProcesses) {
Console.WriteLine(p.ProcessName);
}
}
}
using System.Diagnostics;
foreach (Process p in Process.GetProcesses())
{
Console.WriteLine(p.ProcessName);
}
foreach (Process p in Process.GetProcessesByName("notepad"))
{
Console.WriteLine(p.ProcessName);
}
Process[] process = Process.GetProcessesByName("notepad");
if (process.Length > 0)
{
Console.WriteLine("Notepad is running");
}
else
{
Console.WriteLine("Notepad is not running");
}
instead of [ spoiler ] (it just makes it all the most neater, And as Cyb3r pointed out you can use it for detecting if a process is currently running or not :p & you can use it for killing processes also)
Copyright © 2024, NextGenUpdate.
All Rights Reserved.