Entry
Getting Windows version
Jul 5th, 2000 10:03
Nathan Wallace, Hans Nowak, Snippet 356, Emile van Sebille
"""
Packages: operating_systems.windows
"""
"""
By the way, in windows at a command prompt:
95,98: net config
nt: net config [server|workstation]
gives a line that starts : Software version
I thought I'd key in it a script real quick, but I don't have
enough time now to wrap it up. Maybe it will get you started.
"""
import sys
def getwinver():
import os
winver = None
test = os.system('net config > xxconfig.net')
if test == 0:
f = open('xxconfig.net', 'r')
config = f.readlines()
f.close()
for line in config:
#print line
sys.stdout.write(line)
if line[:16] == "Software version":
winver = line
else:
pass # test value is error code
return winver
if __name__ == "__main__":
print getwinver()