I have since uploaded the code to Scribd.com and embedded it below. Editing/posting code on Blogger stinks. I think this should work out better.
It's often very useful (e.g. login scripts and such) to detect the version of the current operating system. I originally started with some code from elsewhere (http://www.amset.info/loginscripts/os-id.asp), but I've enhanced it a lot over time.
Below is my latest version of this code.
This code also detects 32-bit vs. 64-bit, and if a system is running Server Core on Server 2008 or Server 2008 R2.
The %opsys% environmental variable is set to the current operating system (win9x, win2k, winxp, win2003, win2008, win2008R2, vista, win7).
The %pf% variable is set to the proper Program Files directory (generally c:\program files on 32-bit, c:\program files(x86) on 64-bit) for most software installs and/or checks.
The %servercore% variable is set to either "false" (it isn't a Server Core system) or "true" (it is a Server Core system).
The %bits% variable is set to either 32 (if a 32-bit system) or 64 (if a 64-bit system).
No comments:
Post a Comment