WSHを使用して、OSの起動時間と起動してからの経過時間を表示する例です。
WMIで各値を取得するのですが、UTCで値が返ってきますので、このサイトで紹介した
UTCを変換する関数を利用しています。
Option Explicit Call Uptime() '=========================================================================== Sub Uptime() Dim OBJ_WMIService Dim OBJ_Item Dim COL_Item Dim STR_Computer Dim STR_NameSpace Dim STR_BootUpTime Dim STR_LocalTime Dim STR_Work Dim STR_Day Dim STR_Hour Dim STR_Min STR_Computer = "." STR_NameSpace = "/root/cimv2" Set OBJ_WMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & STR_Computer & STR_NameSpace) If Err.Number <> 0 Then WScript.Echo "Error=" & Err.Number WScript.Echo "ERROR Code=" & Err.Number & " Description=" & Err.Description Err.Clear Exit Sub End If Set COL_Item = OBJ_WMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem") For Each OBJ_Item In COL_Item STR_BootUpTime = OBJ_Item.LastBootUpTime STR_LocalTime = OBJ_Item.LocalDateTime Next STR_BootUpTime = ConvertUTCToDate(STR_BootUpTime) STR_LocalTime = ConvertUTCToDate(STR_LocalTime) STR_Work = DateDIff("n", STR_BootUpTime, STR_LocalTime) STR_Day = Fix((STR_Work / 60 ) / 24) STR_Hour = (STR_Work / 60) Mod 24 STR_Min = STR_Work Mod 60 WScript.Echo "起動時刻: " & STR_BootUpTime WScript.Echo "経過時間: " & STR_Day & " 日 " & STR_Hour & " 時間 " & STR_Min & " 分" End Sub '=========================================================================== Function ConvertUTCToDate(STR_DateTime) ConvertUTCToDate = CDate(Mid(STR_DateTime, 5, 2) & "/" & _ Mid(STR_DateTime, 7, 2) & "/" & Left(STR_DateTime, 4) & " " & _ Mid(STR_DateTime, 9, 2) & ":" & _ Mid(STR_DateTime, 11, 2) & ":" & _ Mid(STR_DateTime, 13, 2)) End Function
gay chat web cab room facebook says:
gay men webcam chat rooms https://gaychatnorules.com/
2022/09/04, 14:44gay video chat sites says:
free gay mens chat phone https://gaymusclechatrooms.com/
2022/09/04, 17:24cleveland gay chat line numbers says:
free mobile gay chat https://free-gay-sex-chat.com/
2022/09/05, 00:36gay chat avenue says:
chat random gay https://gayinteracialchat.com/
2022/09/05, 04:04buy benelli guns online says:
… [Trackback]
[…] Read More Info here to that Topic: dragon-ark.com/archives/302 […]
2022/09/10, 21:50sbo says:
… [Trackback]
[…] Here you will find 92929 additional Info on that Topic: dragon-ark.com/archives/302 […]
2022/09/14, 15:17Bassetti Handtuch günstig says:
… [Trackback]
[…] Find More on on that Topic: dragon-ark.com/archives/302 […]
2022/09/15, 19:23https://simdaiphat.vn/sim-ongdia.html says:
… [Trackback]
[…] Info to that Topic: dragon-ark.com/archives/302 […]
2022/09/20, 18:58pictures of ecstasy drug, says:
… [Trackback]
[…] Here you will find 92162 additional Information on that Topic: dragon-ark.com/archives/302 […]
2022/09/23, 10:13Hilton Head SC Beaches says:
… [Trackback]
[…] Info on that Topic: dragon-ark.com/archives/302 […]
2022/10/01, 08:50cabo san lucas real estate says:
… [Trackback]
[…] Find More Info here to that Topic: dragon-ark.com/archives/302 […]
2022/10/08, 11:47