我用的是windows 7和xp。我想知道系统的正常运行时间。
获得正常运行时间的命令/过程是什么?
我用的是windows 7和xp。我想知道系统的正常运行时间。
获得正常运行时间的命令/过程是什么?
有两种方法可以做到。
选项1:
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
希望对你有所帮助!!
以下是在Windows操作系统中查找正常运行时间的8种方法。
1:使用任务管理器
在Windows Vista和Windows Server 2008中,任务管理器得到了加强,可以显示关于系统的额外信息。其中一条信息是服务器的运行时间。
右键单击任务栏,然后单击任务管理器。您也可以单击CTRL+SHIFT+ESC进入任务管理器。 在“任务管理器”中,选择“性能”选项卡。 当前系统正常运行时间显示在win8 /10的系统或性能⇒CPU。
2:通过使用系统信息实用程序
systeminfo命令行实用程序检查并显示各种系统统计信息,如安装日期、已安装的修补程序等。 打开命令提示符,输入以下命令:
systeminfo
你也可以将结果缩小到你需要的一行:
systeminfo | find "System Boot Time:"
3:通过使用正常运行时间实用程序
微软发布了一个名为Uptime.exe的工具。它是一个简单的命令行工具,用于分析计算机的可靠性和可用性信息。它可以在本地或远程工作。在简单的形式中,该工具将显示当前系统正常运行时间。高级选项允许您访问更详细的信息,如关机、重新启动、操作系统崩溃和Service Pack安装。
阅读下面的KB以获得更多信息和下载链接:
MSKB232243: Uptime.exe工具允许您评估Windows NT 4.0 SP4或更高版本的服务器可用性。
要使用它,请遵循以下步骤:
Download uptime.exe from the above link, and save it to a folder, preferably in one that's in the system's path (such as SYSTEM32). Open an elevated Command Prompt window. To open an elevated Command Prompt, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator. You can also type CMD in the search box of the Start menu, and when you see the Command Prompt icon click on it to select it, hold CTRL+SHIFT and press ENTER. Navigate to where you've placed the uptime.exe utility. Run the uptime.exe utility. You can add a /? to the command in order to get more options.
它没有提供很多命令行参数:
C:\uptimefromcodeplex\> uptime /?
usage: Uptime [-V]
-V display version
C:\uptimefromcodeplex\> uptime -V
version 1.1.0
3.1:通过使用旧的正常运行时间实用程序
有一个旧版本的“uptime.exe”实用程序。这样做的优点是不需要。net。(除了简单的正常运行时间,它还有更多的功能。)
下载链接:Windows NT 4.0服务器正常运行时间工具(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.
4:通过使用NET STATISTICS实用程序
另一种简单的方法(如果您还记得的话)是使用NET statistics命令显示的统计信息中的近似信息。 打开命令提示符,输入以下命令:
net statistics workstation
统计数据应该告诉您它运行了多长时间,尽管在某些情况下,该信息不如其他方法准确。
5:使用事件查看器
Probably the most accurate of them all, but it does require some clicking. It does not display an exact day or hour count since the last reboot, but it will display important information regarding why the computer was rebooted and when it did so. We need to look at Event ID 6005, which is an event that tells us that the computer has just finished booting, but you should be aware of the fact that there are virtually hundreds if not thousands of other event types that you could potentially learn from.
注意:顺便说一句,6006事件ID告诉我们服务器什么时候宕机了,所以如果在6006和6005事件之间有很大的时间差异,服务器宕机了很长时间。
注意:您也可以通过输入eventvwr打开事件查看器。您也可以使用在管理工具文件夹中找到的快捷方式。
Click on Event Viewer (Local) in the left navigation pane. In the middle pane, click on the Information event type, and scroll down till you see Event ID 6005. Double-click the 6005 Event ID, or right-click it and select View All Instances of This Event. A list of all instances of the 6005 Event ID will be displayed. You can examine this list, look at the dates and times of each reboot event, and so on. Open Server Manager tool by right-clicking the Computer icon on the start menu (or on the Desktop if you have it enabled) and select Manage. Navigate to the Event Viewer.
5.1: Eventlog via PowerShell
Get-WinEvent -ProviderName eventlog | Where-Object {$_.Id -eq 6005 -or $_.Id -eq 6006}
6:编程方式,通过使用GetTickCount64
GetTickCount64检索自系统启动以来经过的毫秒数。
7:使用WMI
wmic os get lastbootuptime
8: Windows XP及以上版本的新uptime.exe
像微软的工具一样,但与所有操作系统兼容,包括Windows 10和Windows Server 2016,这个正常运行时间实用程序不需要升高的命令提示符,并提供了一个选项,以DD:HH:MM:SS和人类可读的格式(当使用-h命令行参数执行时)显示正常运行时间。
此外,这个版本的uptime.exe即使在explorer.exe会话中正常启动(即不是通过命令行),也会运行并显示系统正常运行时间,并暂停正常运行时间被读取:
当uptime -h执行时:
我使用这个PowerShell小片段:
function Get-SystemUptime {
$operatingSystem = Get-WmiObject Win32_OperatingSystem
"$((Get-Date) - ([Management.ManagementDateTimeConverter]::ToDateTime($operatingSystem.LastBootUpTime)))"
}
然后产生如下内容:
PS> Get-SystemUptime
6.20:40:40.2625526