[英]How to get details of running process in a computer using c# .net?
I am developing a windows service that store the details of current processes. 我正在开发一个Windows服务,用于存储当前进程的详细信息。 How do I get the details of process running in system and store that in a file using windows service using c# .NET.
我如何获取在系统中运行的进程的详细信息,并使用c#.NET使用Windows服务将其存储在文件中。
I am trying to get all the information about a system(computer). 我正在尝试获取有关系统(计算机)的所有信息。
What are the files opened, which website is browsed etc. along with who is the current user. 打开了哪些文件,浏览了哪些网站,以及谁是当前用户。
There are many aspects to a process, but you can get most of them off of the System.Diagnostics.Process
object: 流程涉及很多方面,但是您可以从
System.Diagnostics.Process
对象中获取大部分内容:
Process[] allProcesses = Process.GetProcesses();
That will get you information on all running processes. 这将为您提供所有正在运行的进程的信息。
However much of the information you are looking for, such as what website is being browsed, simply isn't available to other processes. 但是 ,您正在寻找的许多信息(例如正在浏览的网站)根本无法用于其他进程。 You could get some information about which files are open based on file-handles/locks, but even that will be somewhat limited.
您可以基于文件句柄/锁获得有关打开哪些文件的一些信息,但即使这样也会受到一定限制。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.