我正在使用Windows 7和XP操作系统。我想了解系统的运行时间。
如何获取系统运行时间?请提供命令/步骤。
以下是在Windows操作系统中找到Uptime的八种方法:
在Windows Vista和Windows Server 2008中,任务管理器已被加强以显示有关系统的附加信息。其中一项信息是服务器的运行时间。
当前系统的正常运行时间显示在“系统”或“性能⇒ CPU”下(适用于Win 8/10)。
systeminfo
命令行实用程序检查并显示各种系统统计信息,例如安装日期、安装的热修复程序等。打开命令提示符并键入以下命令:
systeminfo
您还可以将结果缩小到您需要的那一行:
systeminfo | find "System Boot Time:"
微软发布了一个名为Uptime.exe的工具。它是一个简单的命令行工具,分析计算机的可靠性和可用性信息。它可以在本地或远程工作。在其简单形式下,该工具将显示当前系统的正常运行时间。高级选项允许您访问更详细的信息,例如关闭、重新启动、操作系统崩溃和服务包安装。
阅读以下KB获取更多信息和下载链接:
要使用它,请按照以下步骤操作:
uptime.exe
实用程序。 您可以在命令中添加/?以获取更多选项。
它不提供许多命令行参数:
C:\uptimefromcodeplex\> uptime /?
usage: Uptime [-V]
-V display version
C:\uptimefromcodeplex\> uptime -V
version 1.1.0
有一个旧版本的“uptime.exe”实用程序。它的优点是不需要.NET(它还有比简单的运行时间更多的功能。)
下载链接:Windows NT 4.0 Server Uptime工具(uptime.exe)(最终x86版本)
C:\uptimev100download>uptime.exe /?
UPTIME, Version 1.00
(C) Copyright 1999, Microsoft Corporation
Uptime [server] [/s ] [/a] [/d:mm/dd/yyyy | /p:n] [/heartbeat] [/? | /help]
server Name or IP address of remote server to process.
/s Display key system events and statistics.
/a Display application failure events (assumes /s).
/d: Only calculate for events after mm/dd/yyyy.
/p: Only calculate for events in the previous n days.
/heartbeat Turn on/off the system's heartbeat
/? Basic usage.
/help Additional usage information.
另一种简单的方法,如果您能记住它,就是使用NET STATISTICS命令显示的统计信息中找到的近似信息。打开命令提示符并键入以下命令:
net statistics workstation
统计数据应该告诉你系统运行了多久,但在某些情况下,这些信息可能不如其他方法准确。
这可能是所有方法中最准确的一种,但需要点击操作。它不显示从上次重新启动以来的确切天数或小时数,但会显示有关计算机何时以及为什么重新启动的重要信息。我们需要查看事件ID 6005,这是一个事件,告诉我们计算机刚刚完成启动,但您应该意识到,实际上有成百上千种其他事件类型可以学习。
注意:顺便提一下,6006事件ID可以告诉我们服务器何时关闭,因此如果6006和6005事件之间有很长时间差,那么服务器已经关闭了很长时间。
注意:您还可以通过在“运行”命令中键入eventvwr.msc来打开事件查看器,也可以使用管理工具文件夹中找到的快捷方式。
Get-WinEvent -ProviderName eventlog | Where-Object {$_.Id -eq 6005 -or $_.Id -eq 6006}
GetTickCount64检索自系统启动以来经过的毫秒数。
wmic os get lastbootuptime
这个 uptime 实用程序 不仅兼容于微软的工具,而且还支持包括 Windows 10 和 Windows Server 2016 在内的所有操作系统。此外,它不需要提升的命令提示符,并提供了在 DD:HH:MM:SS 和人类可读格式中显示正常运行时间的选项(当使用 -h
命令行参数执行时)。
此外,这个版本的 uptime.exe
即使从普通的 explorer.exe 会话中启动(即不通过命令行启动),也可以运行并显示系统正常运行时间,并暂停以便读取:
当执行为 uptime -h
时:
systeminfo
并检查整个输出即可。 - FelixD我使用这个小的PowerShell代码片段:
function Get-SystemUptime {
$operatingSystem = Get-WmiObject Win32_OperatingSystem
"$((Get-Date) - ([Management.ManagementDateTimeConverter]::ToDateTime($operatingSystem.LastBootUpTime)))"
}
然后就会得到类似下面的东西:
PS> Get-SystemUptime
6.20:40:40.2625526
1. Go to "Start" -> "Run".
2. Write "CMD" and press on "Enter" key.
3. Write the command "net statistics server" and press on "Enter" key.
4. The line that start with "Statistics since …" provides the time that the server was up from.
The command "net stats srv" can be use instead.
选项 2:
Uptime.exe 工具允许您使用 Windows NT 4.0 SP4 或更高版本估计服务器的可用性。
http://support.microsoft.com/kb/232243
希望对您有所帮助!
net statistics server
。 - s0d4pop