UNIX systems typically ship with the ‘uptime’ utility to display the operating systems running time, Windows doesn’t include this command however an uptime.exe is available in the Windows Resource Kit and can be downloaded from http://support.microsoft.com/kb/232243.
Having said that current versions of Windows (including XP) ship with the ‘systeminfo’ command line tool that displays the operating system boot time in addition to:
- Hostname, OS, PC Manufacturer, Model and Speed
- OS Installation time
- Memory, Time zone, system folders, BIOS version and locale configuration
- Domain, Logon Server, Network Card details
- Installed hot fixes
To display just the OS startup time:
-
systeminfo |find "System Boot Time:"
-
System Boot Time: 14/08/2010, 17:32:40
To display it without the ‘System Boot Time’ text you can use the ‘for’ command:
-
14/08/2010, 17:32:40
Or to set an environment variable to the current boot time:
-
14/08/2010, 17:32:40
Note: If you intend to use the above inside a batch file you’ll need to double on the % characters (i.e. %a becomes %%a) – this is a requirement of the for command when used within batch files.
One Response to Windows System Uptime and System Information