Find Windows system uptime from the command line

Here’s a quick and easy way of checking how long a Windows server or workstation has been up, via the command line.  It pipes the results of Net Statistics Workstation into find.  Run the following from a command prompt:

net statistics workstation | find /i “statistics since”

The results will look like

Statistics since 8/12/2009 11:08 PM

Which shows the machine has been up since 11:08pm on August 12, 2009.

Comments [16]

  1. Nice! I didn’t know about that. I use:

    systeminfo | findstr Time:


    1. Just worked out that the explicit version of that is:

      systeminfo | findstr /bc:”System Up Time”


    2. Problem with this is it doesn’t always return a value. When I do this on my Windows XP SP2 machine the following is returned, not sure why.

      System Up Time: N/A


      1. I have the same problem, and I upgraded my XP system for SP2 to SP3, but the problem not fixed.

        Anyone has an idea for this ?

  2. Most systems will also work with a

    dir c:\ /ah

    and look at the time stamp for pagefile.sys (obviously relies on the pagefile being on c:)

  3. This also works: systeminfo | findstr /c:”System Boot Time”

    1. CypherBit-

      On Windows XP it’s actually
      systeminfo | findstr /c:”System Up Time”

      systeminfo | findstr /c:”System Boot Time”
      does not return anything


      1. Indeed, I only did a quick test on Vista…why they change things like that is beyond me.

  4. The “systeminfo” and “net statistics” methods both have their own advantages:

    Net statistics:

    Runs more quickly
    Gives the date and time the machine started*

    Can be run against a remote machine (without psexec etc.)
    Gives the time since the machine started*

    *This depends on your preference

  5. I should also say that net statistics is slightly evil because it shows dates in US format, regardless of the regional settings in Windows. Why can’t everyone use ISO formats?!

  6. the net stat command will only show when the network was started. This command will work across all platforms.

    Systeminfo looks like it depends on the version. You can always script it and check the version of the OS that is running. Then check the value.

  7. WMI is rather good too. Here’s the wmi version using the native tool WMIC:

    wmic OS Get LastBootUpTime | findstr +

    (advantage: outputs in ISO date format)

  8. Uptime.exe from the NT4 Resource Kit – It “does what it says on the tin”, and also calculates availability statistics for arbitrary time horizons. Haven’t tried it under 2K8 yet.

  9. Thanks for the info on how to get system uptime.

    For the record I wonder how many others got NOTHING that is N/A showing on a just booted XP on the
    Sytem Up Time:
    line from the systeminfo command?

    Net statistics workstation

    worked great though, and

    DIR C:\ /ah

    also good plus the added bonus of being at the level of technical trivia knowledge.


  10. Doesn’t work on XP SP3 at least, find parameter is wrong it informs.

    net statistics workstation | find “Statistics since”

    seems to work just fine though.

Leave a Reply

Your email address will not be published. Required fields are marked *