Help - Search - Members - Calendar
Full Version: Is there a test to determine 64bit or 32bit?
MSFN Forums > Microsoft Software Products - Discussion & Support > Windows Vista

   
Google Internet Forums Unattended CD/DVD Guide
Aerospace
Hello, I am working on a manual Vista update script (well batch actually) and I'm looking to find if there is some sort of test as a command line, VB script or something of that nature to determine if the current installation of Vista is x64 or x86. Right now I have 2 separate batch files, one for each type (x64 and x86.) I would like to simplify it to one that could determine on its own which set of updates to use. I've had no luck searching the forum or Google. Does anyone know of any relatively painless way to do that or is what I want going to be a complex project?
cluberti
You could create a vbscript that checked the Win32_Processor or Win32_OperatingSystem class(es) to determine if x86 or x64 is installed.
Mr Snrub
If it's a straight batch file then you could add the following to make a conditional jump if the installed OS is not 64-bit:
CODE
if "%programfiles(x86)%XXX"=="XXX" goto 32BIT

Follow this line with your 64-bit specific parts, and where the 32-bit part starts have the following label:
CODE
:32BIT


The following is a complete batch file which just echos to the screen which platform it believes is present, as an example:
QUOTE
@echo off
if "%programfiles(x86)%XXX"=="XXX" goto 32BIT
echo 64-bit Windows installed
goto END

:32BIT
echo 32-bit Windows installed

:END



Edit:
An alternative could be to check the environment variable PROCESSOR_ARCHITECTURE, e.g.
CODE
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT

(Yes, on Intel Core2 Duo CPUs this variable is still reported as AMD64.)
gunsmokingman
Here is a VBS script that will report back if it either a x86 or x64

Save as Checkx86x64.vbs
QUOTE
CODE
Dim Col, Obj, strComputer, Wmi
strComputer = "."
Set Wmi = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set Col = Wmi.ExecQuery("SELECT * FROM Win32_Processor",,48)
  For Each Obj in Col
  '-> X86
   If InStr(LCase(Obj.Caption),LCase("x86")) Then
   '-> Place Your Code Below Here
    Wscript.Echo "Caption: " & Obj.Caption
   End If
   '-> X64
   If InStr(LCase(Obj.Caption),LCase("x64")) Then
   '-> Place Your Code Below Here
    Wscript.Echo "Caption: " & Obj.Caption
   End If
  Next
Aerospace
Thanks guys! You've given me a lot to work with now. I'll play around with these and see what's going to work best for me.

@Mr Snrub: The Program Files x86 folder test is so simple, I don't know why I didn't think of it.
lalapnt
wow, this will be useful to me too...cuz i have looking for something like this for a very long time...but i thought tuneup utilities could tell you this info too. rolleyes.gif
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.