This simple one-liner for Powershell will print the current uptime of your PC. This is printed with multiple columns but it also may be printed on one line.
PS C:\Users\Windows 11> (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime Days : 0 Hours : 0 Minutes : 41 Seconds : 27 Milliseconds : 915 Ticks : 24879150105 TotalDays : 0.0287953126215278 TotalHours : 0.691087502916667 TotalMinutes : 41.465250175 TotalSeconds : 2487.9150105 TotalMilliseconds : 2487915.0105 |
This example prints everything on one line. This prints the proper date and time when the PC was booted up into Windows 11.
PS C:\Users\Intel i5> (gcim Win32_OperatingSystem).LastBootUpTime | Foreach {($_ -split '\s:',4)[0..2]} 04/27/2022 05:29:02 |
This is the perfect solution to print the information you need.