Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static bool ProcessCompareInternalName(Process p,string match)
- {
- try
- {
- string internalname = p.MainModule.FileVersionInfo.InternalName;
- if (internalname.ToLower() == match.ToLower()) return true;
- else return false;
- }
- catch (System.ComponentModel.Win32Exception)
- {
- return false;
- }
- }
- static void Main(string[] args)
- {
- var allproc = Process.GetProcesses();
- foreach (Process p in allproc)
- {
- if (ProcessCompareInternalName(p, "program.exe"))
- {
- p.Kill();
- }
- }
- }
Add Comment
Please, Sign In to add comment