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.

16 Responses to “Find Windows system uptime from the command line”

  1. Andrew Says:

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

    systeminfo | findstr Time:


    • Andrew Says:

      Just worked out that the explicit version of that is:

      systeminfo | findstr /bc:”System Up Time”


    • Julie Says:

      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


      • alMubarmij Says:

        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. andy Says:

    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. Tech: How to tell how long your PC has been running « TechGeekandMore Blog Says:

    […] for this post goes to Julie @ thebackroom tech blog ( ) Leave a […]

  4. CypherBit Says:

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

    • Julie Says:


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

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


      • CypherBit Says:

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

  5. Sahmeepee Says:

    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

  6. Sahmeepee Says:

    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?!

  7. aig1979 Says:

    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.

  8. Sahmeepee Says:

    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)

  9. Andy N Says:

    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.

  10. Jay Says:

    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.


  11. Carl Says:

    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

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: