August 26, 200818 yr 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?
August 27, 200818 yr You could create a vbscript that checked the Win32_Processor or Win32_OperatingSystem class(es) to determine if x86 or x64 is installed.
August 27, 200818 yr 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:if "%programfiles(x86)%XXX"=="XXX" goto 32BITFollow this line with your 64-bit specific parts, and where the 32-bit part starts have the following label::32BITThe following is a complete batch file which just echos to the screen which platform it believes is present, as an example:@echo offif "%programfiles(x86)%XXX"=="XXX" goto 32BITecho 64-bit Windows installedgoto END:32BITecho 32-bit Windows installed:ENDEdit:An alternative could be to check the environment variable PROCESSOR_ARCHITECTURE, e.g.if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT(Yes, on Intel Core2 Duo CPUs this variable is still reported as AMD64.)
August 27, 200818 yr Here is a VBS script that will report back if it either a x86 or x64Save as Checkx86x64.vbsDim Col, Obj, strComputer, WmistrComputer = "." 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
August 27, 200818 yr Author 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.
August 28, 200818 yr 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.
Create an account or sign in to comment