Esmail Bonakdarian wrote:
Hi,

Is there a way to display how long a Win XP system has been up?
Somewhat analogous to the *nix uptime command.

Thanks,
Esmail

Just run the built-in Windows utility 'systeminfo' from a cmd prompt. Python can call 'systeminfo' like this:


import os

uptime = os.popen('systeminfo', 'r')
data = uptime.readlines()
uptime.close

for line in data:
   if line contains "System Up Time":
      print line

Please note that 'systeminfo' is only present on Windows XP PRO and Windows Server 2003... Windows XP HOME does not have this command.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to