From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26717 invoked by alias); 30 Jan 2009 15:58:18 -0000 Received: (qmail 26701 invoked by uid 22791); 30 Jan 2009 15:58:17 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from wa-out-1112.google.com (HELO wa-out-1112.google.com) (209.85.146.180) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Jan 2009 15:58:13 +0000 Received: by wa-out-1112.google.com with SMTP id j4so252694wah.2 for ; Fri, 30 Jan 2009 07:58:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.115.50.5 with SMTP id c5mr886645wak.7.1233331091756; Fri, 30 Jan 2009 07:58:11 -0800 (PST) In-Reply-To: References: <4982FB77.7020505@byu.net> Date: Fri, 30 Jan 2009 22:08:00 -0000 Message-ID: <183c528b0901300758i4c633f65t7162f96f246d1d17@mail.gmail.com> Subject: Re: Finding either boot time or login time From: Brian Mathis To: cygwin@cygwin.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2009-01/txt/msg00890.txt.bz2 On Fri, Jan 30, 2009 at 10:33 AM, Ronald Fischer wrote: > Eric Blake byu.net> writes: >> man uptime > > I have thought of uptime, but this requires doing date calculation (I have to > subtract the uptime from the current time), which I wanted to avoid; plus I > wanted to have it reproducible (i.e. if I calculate the "startup time" twice > in succession, I wanted to get the same result - using the uptime calculation > might well give differences of, say, one, in rare cases 2, seconds for the > startup time on repeated calculations. > > But it seems there is no alternative. I had not expected that Windows would > not log such events, like starting up or having some user logged in... > > Ronald This information is available in windows by using one of two commands: net stats srv or systeminfo In both cases, you will need to grep (if calling from cygwin) or use the windows "find" command (equivalent of grep), to isolate just the 1 line. I've noticed that, on Vista, "net stats srv" always seems to return 1980, while systeminfo returns the correct result. If that doesn't work for you, I'm sure there are other ways to do it. You might need to write some vbs and query WMI to get the uptime (http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept04/hey0907.mspx) Or you can install the "uptime" tool from Microsoft (http://support.microsoft.com/kb/232243) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/