SS64 Discussion Forum

You are not logged in.

#1 2010-01-01 07:15:46

Ben
New Shoes
Registered: 2010-01-01
Posts: 3

boottime batch

I'm not a script writer, but know the parameters to call for last boot time

XP/2000

systeminfo | find "System Up Time"

Vista/Windows 7

systeminfo | find "System Boot Time"

this is my current batch file for vista/windows 7 machines, however, if i want to lookup the boottime on xp i'll need a separate batch file.

Cmd /k systeminfo | find "System Boot Time"
/pause

What I'm looking for is a batch file to display XP, 2000, Vista, Windows7 last boot.. something that can determine what version the operating system is the print out the information.

Offline

#2 2010-01-01 07:58:59

bluesxman
Sun Fire
From: Leeds, UK
Registered: 2006-12-29
Posts: 701

Re: boottime batch

I'm not sure I understand your request exactly.  Initially I thought that this is what you are after:

systeminfo | findstr "^System.Up.Time ^System.Boot.Time ^OS.Version ^OS.Name"

But reading your post again I'm now wondering if this is what you're actually looking for:

systeminfo | findstr "^System.Up.Time ^System.Boot.Time"

Offline

#3 2010-01-06 06:26:30

Ben
New Shoes
Registered: 2010-01-01
Posts: 3

Re: boottime batch

Sorry, bit of a typo.

I've both 2000(XP) systems and Vista, which require a different string to print out System Boot. So, in order to use a single batch file, NOT two, I need some type of "IF" statement(script) to determine which version of windows the batch file runs on, then print our the desired information ("System Up Time" for XP/2000 or "System Boot Time"
Vista/Windows7)

Offline

#4 2010-01-06 07:56:42

bluesxman
Sun Fire
From: Leeds, UK
Registered: 2006-12-29
Posts: 701

Re: boottime batch

Yes, that's what I (eventually) thought you were asking.  However, if you've tried my second suggestion, you should see that it pulls the correct information out on any of the systems by being a bit more clever about how it selects the lines it wants (without the need to figure out which Windows version it is).

Last edited by bluesxman (2010-01-06 08:04:36)

Offline

Board footer

Powered by FluxBB