Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
- <security>
- <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
- </requestedPrivileges>
- </security>
- </trustInfo>
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.IO;
- using System.Diagnostics;
- namespace ConsoleApplication1
- {
- class Program
- {
- [STAThread]
- static void Main(string[] args)
- {
- var processes = Process.GetProcesses();
- uint c_error = 0;
- foreach (Process pr in processes)
- {
- using (pr)
- {
- Console.Write(pr.ProcessName.PadLeft(25));
- try
- {
- Console.Write("tRunning: " + DateTime.Now.Subtract(pr.StartTime).TotalHours.ToString("F3") + " hours ");
- }
- catch (Exception ex)
- {
- Console.Write("t" + ex.Message);
- c_error++;
- }
- try
- {
- Console.Write("tHasExited: " + pr.HasExited.ToString());
- }
- catch (Exception ex)
- {
- Console.Write("t" + ex.Message);
- c_error++;
- }
- Console.WriteLine();
- }
- }
- Console.WriteLine();
- Console.WriteLine("Processes: {0}, Errors: {1}",
- processes.Length, c_error);
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment