- 윈도우 UPTIME 확인
방법 1: powershell on cmd
방법2의 powershell 명령어를 CMD로 포장한 것.
- 명령어
powershell "$u=Get-WmiObject -Class Win32_OperatingSystem; $u.ConvertToDateTime($u.LocalDateTime)-$u.ConvertToDateTime($u.LastBootUpTime)" | findstr TotalDays
- 실행예시
C:\Users\zetawiki>powershell "$u=Get-WmiObject -Class Win32_OperatingSystem; $u.ConvertToDateTime($u.LocalDateTime)-$u.ConvertToDateTime($u.LastBootUpTime)" | findstr TotalDays
TotalDays : 23.934793401956
- → 부팅된지 약 23.9일 되었다.
방법 2: powershell
- 명령어
$wmi = Get-WmiObject -Class Win32_OperatingSystem
$wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)
- 실행예시
PS C:\Users\zetawiki> $wmi = Get-WmiObject -Class Win32_OperatingSystem
PS C:\Users\zetawiki> $wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)
Days : 23
Hours : 22
Minutes : 18
Seconds : 24
Milliseconds : 8
Ticks : 20675040089290
TotalDays : 23.9294445477894
TotalHours : 574.306669146944
TotalMinutes : 34458.4001488167
TotalSeconds : 2067504.008929
TotalMilliseconds : 2067504008.929
- 명령어 변형예시
$wmi = Get-WmiObject -Class Win32_OperatingSystem
$uptime = $wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)
echo $uptime
- → 변수에 담아둘 수도 있다.
방법 3: uptime.exe
- uptime.exe 다운로드
- http://download.microsoft.com/download/winntsrv40/install/uptime_1.01/nt4/en-us/uptime.exe
- 어디서든 실행할 수 있도록 C:\Windows\System32에 다운로드
C:\Users\zetawiki>uptime
\\JMNOTE-PC has been up for: 3 day(s), 7 hour(s), 10 minute(s), 52 second(s)
→ 3일 7시간 10분 52초
방법 4: systeminfo
- 윈도우 2003, XP에서는 systeminfo에 Uptime이 나온다.[1]
C:\Documents and Settings\jmnote>systeminfo | findstr Time
System Up Time: 42일, 0시간, 54분, 26초
- 윈도우 7에서는 Uptime이 나오지 않는다. 대신 부팅 시각은 알 수 있다.
C:\Users\zetawiki>systeminfo | findstr 부트
시스템 부트 시간: 2014-09-11, 오후 11:49:25
방법 5: wmic
wmic로 부팅시간을 보고 수작업으로 계산하자. (...)[2]
- 명령어
wmic os get lastbootuptime
- 실행예시
C:\Users\zetawiki>wmic os get lastbootuptime
LastBootUpTime
20120715071501.125019+540
- → 2012-07-15 07:15:01