(view source code of is6432os.vbs as plain text)
Option Explicit
Dim intAddressWidth
Dim colItems, objItem, objWMIService
Dim strMsg
If WScript.Arguments.Count > 0 Then Syntax
On Error Resume Next
Set objWMIService = GetObject( "winmgmts://./root/cimv2" )
If Err Then ShowError
Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_Processor", , 48 )
If Err Then ShowError
For Each objItem in colItems
intAddressWidth = objItem.AddressWidth
strMsg = "Windows " & vbTab & ": " & intAddressWidth & "-bit" & vbCrLf _
& "Processor" & vbTab & ": " & objItem.DataWidth & "-bit"
Next
On Error Goto 0
WScript.Echo strMsg
WScript.Quit intAddressWidth
Sub Syntax
strMsg = "is6432os.vbs, Version 1.00" & vbCrLf _
& "Detect if the OS is 32-bit or 64-bit" & vbCrLf & vbCrLf _
& "Usage:" & vbTab & "IS6432OS.VBS" & vbCrLf & vbCrLf _
& "Return:" & vbTab & "return code 32 for 32-bit OS, 64 for 64-bit, or 1 for error" & vbCrLf & vbCrLf _
& "Written by Rob van der Woude" & vbCrLf _
& "http://www.robvanderwoude.com"
WScript.Echo strMsg
WScript.Quit 1
End Sub
Sub ShowError
WScript.Echo "Error #" & err.Number & ": " & Err.Description
WScript.Quit 1
End Sub
page last modified: 2024-04-16; loaded in 0.0084 seconds