如何知道是在Windows启动或关机时? [英] How to know when was Windows started or shutdown?

查看:99
本文介绍了如何知道是在Windows启动或关机时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要开发一个程序在C#中找出是在Windows启动或关机时。

I need to develop a program in C# find out when was Windows started or shutdown.

有没有办法,我可以阅读知道的Windows启动和关机时间的日志文件? ?或者你有任何想法如何做到这一点。

Is there a log file that I can read to know Windows start and shutdown times? Or do you have any ideas how to do so?

编辑:

随着里德·科普塞先生的帮助下,最好的回答是根据本的问题

With the help of Mr. Reed Copsey, the best answer is found under this question.

推荐答案

您可以使用类的 System.Diagnostics.Eventing.Reader 访问系统事件日志。

You can use the classes in System.Diagnostics.Eventing.Reader to access the system Event Logs.

这篇关于如何知道是在Windows启动或关机时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆