"윈도우 uptime"의 두 판 사이의 차이

2번째 줄: 2번째 줄:
;윈도우 UPTIME 확인
;윈도우 UPTIME 확인


==방법 1: wmic==
==방법 1: powershell on cmd==
방법2의 powershell 명령어를 CMD로 포장한 것.
;명령어
;명령어
<source lang='bash'>
<source lang='bash'>
wmic os get lastbootuptime
powershell "$wmi = Get-WmiObject -Class Win32_OperatingSystem; $wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)" | findstr TotalDays
</source>
</source>


;실행예시
;실행예시
<source lang='dos'>
<source lang='dos'>
C:\Users\jmnote>wmic os get lastbootuptime
C:\Users\jmnote>powershell "$wmi = Get-WmiObject -Class Win32_OperatingSystem; $wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)" | findstr TotalDays
LastBootUpTime
TotalDays        : 23.934793401956
20120715071501.125019+540
</source>
</source>
:→ 2012-07-15 07:15:01
:→ 부팅된지 약 23.9일 되었다.


==방법 2: uptime.exe==
==방법 2: powershell==
;명령어
<source lang='powershell'>
$wmi = Get-WmiObject -Class Win32_OperatingSystem
$wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)
</source>
 
;실행예시
<source lang='dos'>
PS C:\Users\jmnote> $wmi = Get-WmiObject -Class Win32_OperatingSystem
PS C:\Users\jmnote> $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
</source>
 
;명령어 변형예시
<source lang='powershell'>
$wmi = Get-WmiObject -Class Win32_OperatingSystem
$uptime = $wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)
echo $uptime
</source>
:→ 변수에 담아둘 수도 있다.
 
==방법 3: uptime.exe==
*uptime.exe 다운로드
*uptime.exe 다운로드
:http://download.microsoft.com/download/winntsrv40/install/uptime_1.01/nt4/en-us/uptime.exe
:http://download.microsoft.com/download/winntsrv40/install/uptime_1.01/nt4/en-us/uptime.exe

2013년 3월 4일 (월) 15:22 판

윈도우 UPTIME 확인

1 방법 1: powershell on cmd

방법2의 powershell 명령어를 CMD로 포장한 것.

명령어
powershell "$wmi = Get-WmiObject -Class Win32_OperatingSystem; $wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)" | findstr TotalDays
실행예시
C:\Users\jmnote>powershell "$wmi = Get-WmiObject -Class Win32_OperatingSystem; $wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)" | findstr TotalDays
TotalDays         : 23.934793401956
→ 부팅된지 약 23.9일 되었다.

2 방법 2: powershell

명령어
$wmi = Get-WmiObject -Class Win32_OperatingSystem
$wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)
실행예시
PS C:\Users\jmnote> $wmi = Get-WmiObject -Class Win32_OperatingSystem
PS C:\Users\jmnote> $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 방법 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\jmnote>uptime
\\JMNOTE-PC has been up for: 3 day(s), 7 hour(s), 10 minute(s), 52 second(s)

→ 3일 7시간 10분 52초

4 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}