WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Determine Platform - OS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Determine platform.

Keywords:  OS Operating System Determine Win 2000 NT 95 98 ME platform

Question:

How can we detect what platform a script is running on?

Answer:

To Detect the platform the script is running on, use the WinVersion function
Note: To decipher between all Windows platforms. Use the function WinVersion(5) to tell which one you have:
Windows		Platform	Major	Minor
95		1		4	0
98		1		4	10
ME		1		4	90
NT 4		2		4	0
NT 2000		2		5	0

;determine platform
versionstring = WinVersion(5)
platform = ItemExtract(1, versionstring, "-") 
major = ItemExtract(2, versionstring, "-") 
minor = ItemExtract(3, versionstring, "-")
if platform == 1 ;Running 95/98/ME
   Switch minor
      case 0 ;Windows 95
         message("Platform is","Windows 95")
         break
      case 10 ;Windows 98
         message("Platform is","Windows 98")
         break
      case 90 ;Windows ME
         message("Platform is","Windows Millenium (ME)")

         break
      case minor;newer platform
         message("Platform is","Newer Windows platform")
         break
EndSwitch
else ;Running NT/2000
   Switch major
      case 4 ;Windows NT 4.0
         message("Platform is","Windows NT 4.0")
         break
      case 5 ;Windows 2000
         message("Platform is","Windows 2000")
         break
      case major ;newer platform
         message("Platform is","Newer Windows platform")
         break
EndSwitch
endif 

exit



Article ID:   W14601
Filename:   Determine platform.txt
File Created: 2002:09:04:11:23:12
Last Updated: 2002:09:04:11:23:12