Aerospace Posted August 26, 2008 Share Posted August 26, 2008 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? Link to comment Share on other sites More sharing options...
cluberti Posted August 27, 2008 Share Posted August 27, 2008 You could create a vbscript that checked the Win32_Processor or Win32_OperatingSystem class(es) to determine if x86 or x64 is installed. Link to comment Share on other sites More sharing options...
Mr Snrub Posted August 27, 2008 Share Posted August 27, 2008 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.) Link to comment Share on other sites More sharing options...
gunsmokingman Posted August 27, 2008 Share Posted August 27, 2008 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 Link to comment Share on other sites More sharing options...
Aerospace Posted August 27, 2008 Author Share Posted August 27, 2008 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. Link to comment Share on other sites More sharing options...
lalapnt Posted August 28, 2008 Share Posted August 28, 2008 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now