0

How do I get system uptime using cmd:

 systeminfo | find "Boot Time"

A pause to let me read it, "press any key to continue..." then exit cmd when I press a key?

With systeminfo | find "Boot Time" alone, I get this and have to exit 'manually'.

C:\Windows\System32>Systeminfo | Find "Boot Time"
System Boot Time:        fre-15-juli- 2022, 23:08:52
2

1 Answer 1

0

A pause to let me read it, "press any key to continue..." then exit cmd when I press a key?
With systeminfo | find "Boot Time" alone, I get this and have to exit 'manually'.

systeminfo | find "Boot Time" & pause & move nul 2>&0

for /f tokens^=3*delims^=^:^   %i in ('"systeminfo | find "Boot Time""')do echo;%j & pause

  • Using pause, it would be:
for /f tokens^=3*delims^=^:^   %i in ('"systeminfo | find "Boot Time""')do echo;%j & pause

Since the intention is to get the output of your command:

systeminfo | find "Boot Time"

Then just put your command in the For /f loop with tokens defined by a : and space as the output string delimiter


Obs.: Use two space in: ...delims^=^:^spacespace%i...


Additional resources:

1
  • Thanks Io-oI but didn't work for me. I wanted to use e.g. systeminfo like so: C:\Windows\System32>systeminfo | find "System Boot Time" where I get back System Boot Time: fre-15-juli- 2022, 23:08:53 C:\Windows\System32> and here, get 'press any key to exit' whereupon cmd would exit on key press and the window would close. Commented Jul 16, 2022 at 22:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .