How to Check How Long Windows 11 Has Been Running via Command Line

How to Check How Long Windows 11 Has Been Running via Command Line

Checking how long Windows has been running since the last boot, known as uptime, is useful for troubleshooting, since many issues clear up after a restart. Windows 11 can report the last boot time and calculate uptime from the TANGKAS39 command line.

The Command

(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime

What It Does

This subtracts the system’s last boot time from the current time, returning how long the system has been running as days, hours, minutes, and seconds. `Get-CimInstance Win32_OperatingSystem` provides the `LastBootUpTime`, and subtracting it from `Get-Date` gives the elapsed uptime directly in a readable duration.

When You’d Use This

This is helpful when troubleshooting, since many issues resolve after a restart and knowing the uptime tells you whether the system has been running a long time. It is also useful for confirming whether a recent restart actually took effect. Long uptimes can correlate with accumulated memory use or pending updates that a restart would clear.

Useful Variations

To simply see the last boot time itself, run `(Get-CimInstance Win32_OperatingSystem).LastBootUpTime`. In Command Prompt, `systeminfo | find “System Boot Time”` shows when the system started. The `net statistics workstation` command also includes a “Statistics since” line reflecting when the session began.

If It Doesn’t Work

If the uptime seems longer than expected after you shut down and powered on, fast startup may be the reason, since it does not fully reset the boot time the way a restart does. For an accurate reset, perform a full restart rather than a shutdown. If the command errors, check that you copied it correctly, since it combines two parts that must both be present.

Good to Know

If your PC uses fast startup, a normal shutdown may not fully reset the boot time the way a restart does, so uptime can appear longer than expected after a shutdown-and-power-on cycle. A full restart gives the most accurate reset, which is why restarting often resolves issues better than shutting down.

Putting It Together

The command shown may look dense at first, but it breaks down into clear parts once you have used it a few times. As part of understanding and controlling what runs on your PC, this command is one you will return to whenever the system feels slow or a program misbehaves. Paired with the related process commands, it gives you a full command-line alternative to Task Manager for diagnosing and managing what is running. Like anything in the terminal, the real value comes from trying it on your own system and adapting the variations above to what you actually need, so it is worth experimenting with in a safe, low-stakes situation before relying on it in a script or during troubleshooting. Keeping a note of the commands you find most useful, along with the variations that fit your workflow, turns scattered one-off tricks into a personal reference you can draw on whenever a similar task comes up again.

Leave a Reply

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