Sometimes it is better to do it with OS tools, sometimes it is better to ...

Started by snowsnowsnow, December 31, 2013, 11:27:07 AM

Previous topic - Next topic

snowsnowsnow

do it programmatically.

The "it" in question is (are) one or the other of:

1) Determining system uptime (when it is more than 49 days).
1a) Determining when the system was booted (essentially the same thing, but in a different form)
2) Determining when a process was started.

The "system tools" answer to the above 3 questions are:

1) "systeminfo" contains a line that tells uptime.  Search the output for "Up" (in XP - I think it is different in later versions of Windows).
1A) "net statistics workstation" contains a line that tells when the system was booted.  Search for "since".
2) Process Explorer (procexp on my systems) will tell you the process start time if you double click the process.  Note, BTW, that if you double click a system process (e.g., crss.exe), it probably ends up telling you when the system was booted (i.e., answers question 1A)

So, now, I assume that each of these is also answerable via WMI.  Can you tell me the WinBatch ways to get these pieces of info?  Thanks.

Deana

Deana F.
Technical Support
Wilson WindowWare Inc.

snowsnowsnow


td

Quote from: snowsnowsnow on January 02, 2014, 12:40:50 PM
Thanks, Deana.  Those look like what I am looking for.

You can ignore this if you have upgraded to the latest version of WinBatch but you have mentioned in the past that you are using an old version of WinBatch.  Somewhere around 2005, IIRC.  If that is still the case, you will not be able to use the tech. db dotNet script to get the system up time.  However, you could use the win32 function 'QueryUnbiasedInterruptTime' with the aid of DllCall and a bit of post call value manipulation to get the same result. The API isn't available until Windows 7  and newer so you may not find it any more helpful than the dotNet solution.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

snowsnowsnow

Heh - Luddite that I am, I refuse to use anything past Windows XP or WB 2006D.