|
| ||||||||||
| Tags: vista, windows 2000, windows 95, windows 98, windows 98se, windows me, windows nt4, windows xp |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Calculate the time to reboot in Windows
To calculate the time you restart Windows, we will create a script VBScript (Visual Basic Scripting Edition). But before beginning the creation of the script itself, let us first on its operation. How the script: The script writing a value in the registry (HKCU \ Software \ Microsoft \ Current Version \ run) to be able to restart at startup. Then, another value containing the time is recorded in the registry and then reboot is launched. Restarting, the script saves time in a variable and then checks if the value containing the first time there. If yes, then you just have to compare the two time to get the startup time. Finally, the two keys are added in the register are deleted (the key run and where the key is stored hour). Creation of the script: Open your favorite editor (Notepad will perfectly case: Start menu, select Run ... and type notepad) and copy the following: Option Explicit On Error Resume Next Sunday Wsh, time1, Time2, Result, PathFile, msgResults, MsgA, AppName, Keya, Keyb, TimeDiff MsgA = "timing for restarting, please close all running applications and click OK." Keya = "HKEY_CURRENT_USER \ Software \ RestartTime \" Keyb = "HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Run \ RestartTime" AppName = "Restart-Time" Set Wsh = CreateObject ( "WScript.Shell") PathFile = "" "" & WScript.ScriptFullName & "" "" Result = wsh.RegRead (Keya & "Times") if Result = "" then if Result = "" then MsgResults = Msgbox (MsgA, vbOKCancel, AppName) If msgResults = vbCancel then WScript.Quit Wsh.RegWrite & "Times", left (Time, 8), "REG_SZ" Wsh.RegWrite Keyb, PathFile, "REG_SZ" Wsh.Run "cmd / c Shutdown-r-t 00", false, 0 else Wsh.RegDelete & "Times" Wsh.RegDelete Keya Wsh.RegDelete Keyb TimeDiff = DateDiff ( "s", Result, left (Time, 8)) MsgBox "PC restarted in" TimeDiff & & "seconds", vbInformation, AppName end if Wscript.Quit Save the file on the desktop with the name-Time.vbs Restart. Note that the script can have the name of your choice (with the. Vbs) and can be performed anywhere on the disc (unlike the first version of the script). Using the script:
Note: This trick is usable directly in Windows 98/98 Second Edition, Windows ME, 2000 and XP and all versions of Windows using Internet Explorer 5 or higher. If this is not your case you should download from the Microsoft site version 5 of MSE (Microsoft Scripting Engines) or higher. For more information about VBS, an address: http://support.microsoft.com/support.../q188/1/35.asp. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Calculate the time to reboot in Windows" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to calculate the average time in excel | Rao's | Windows Software | 1 | 06-01-2012 09:48 PM |
| Theme keeps changing every time I reboot under Windows 7 | Jai-Ho | Operating Systems | 4 | 24-10-2010 05:13 AM |
| How to Calculate Process Time in Java? | Bhardwaj | Software Development | 3 | 08-12-2009 11:25 AM |
| How to calculate time infopath | Dharmavira | Windows Software | 3 | 14-07-2009 09:57 AM |
| Windows XP Automatic Updates 'Disabled'- every time after reboot!! | Can't_Stand_Hackers | Windows Update | 7 | 29-07-2008 06:39 AM |