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.
Check out the following code that should be able to get system "uptime":
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/dotNet/System_Diagnostics+System~Uptime.txt
Here is a WMI code sample to get last boot up time:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/WMI+Last~Reboot~Time.txt
And here is a DllCall code sample to get a processes start time:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/How~To+Determine~Process~Start~Time.txt
Thanks, Deana. Those look like what I am looking for.
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.
Heh - Luddite that I am, I refuse to use anything past Windows XP or WB 2006D.