Click here to Skip to main content
15,883,623 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a little problem and im stuck with my application since im not sure if it will work correctly on a x64 bit version.
Now im trying to create a VBScript which will check for OS bit and install the msi according to the OS bit.
I have found a lot of trash by googling for this solution which i think im not sure if it will work.

I have found another interesting code which will check if ProgramFilesx86 exist but the problem is only win7 has this option to check for xp and vista this folder seems not to exists. My processor is 32bit and i cant install an OS x64 to check it myself what differences are there to ensure what OS architecture it is.
I ask for help if somebody could tell me which folders or files or system files are different to a 32bit OS so to make a script to make sure which msi i can install(i will embed both assemblies on the main package)
Some scripts try to check from registry which will not work to all win versions.
Please refer me to the right answer, thanks Begi
Posted
Comments
Sergey Alexandrovich Kryukov 26-Sep-12 16:14pm    
Do you mean instruction-set architecture?
--SA
Sergey Alexandrovich Kryukov 26-Sep-12 16:19pm    
I'm just curious: what makes you using VBScript for such things? What would you do if the script tells you the answer? Execute or install appropriate version of some application? If this is your goal, this would not be the best way to deploy the application. In particular, you can pack all the required checks in the MSI itself, but it depends on what instruments do you use for development of application, its build, and for creation of MSI. Chances are, there is much better way.
--SA
[no name] 26-Sep-12 16:25pm    
No i want it to check via VBScript. "André Kraak" just answered my question.
Sergey Alexandrovich Kryukov 26-Sep-12 16:59pm    
The question is: why?
--SA

1 solution

The way I check the bit version of the OS is by checking for the presence of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node[^].
If this key is not present you are on a 32-bit OS and 64-bit when it is present.
 
Share this answer
 
Comments
[no name] 26-Sep-12 16:23pm    
So this means this registry key exists on ALL WINDOWS VERSIONS OF 64 BIT? then you made my day brother!
Sergey Alexandrovich Kryukov 26-Sep-12 17:01pm    
Great, but I'm afraid OP and I still don't know how to do it with VBScript or Windows Scripting Host. Any more info? (I voted 4.)
--SA
[no name] 26-Sep-12 17:27pm    
Look i have for example 2 Applications 86.exe and 64.exe and A VBSCRIPT that checks if the above mentioned registry key exists. If key exists it must be a 64 os so i run 64.exe else 86.exe

All these 3 files i archive into the Winrar and make it a selfextracting executable file. Call it "MySetupCreatedUnderWinrar.exe" under winrar i give some paths where these 3 files should be extarcted and which should be firstly executed when the user hits twice the "MySetup...exe" file on his computer!
Sergey Alexandrovich Kryukov 26-Sep-12 17:35pm    
Yes, I exactly understand why do you need something like that. (But you don't need it in pure-.NET applications which can use "AnyCPU" target, due to JIT. Did you know that?)
The thing is: I would prefer applications which do not need installations (or self-install, with minimal to no footprint), you already do MSI. Once you already do it, it would be much nicer to have different versions for different instruction-set architectures to be chosen during installation. Got my point?
--SA
[no name] 26-Sep-12 17:46pm    
Yes thats something i can learn from you brother. Im aware of the AnyCPU option but as i researched on internet i found very very topics about this topic. And this topic confuses me very much so far as ive seen on web. Some people say like you some others say No you must first register it under Wow64 in cmd.exe before you can run, some others say it is CPU dependent if i create it in my pc which is 32bit processor it will not run in a 64 bit processor since ive created it via my processor 32 bit and lots of trash which has me confused that ive decided to make 2 apps 86 and 64.
What is your opinion about AnyCPU i want to know and whats about JIT? And further i am not creating games or complex apps, the more complexed thing i use in my App are APIs
I wait for your response to bring some more light into this darkness!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900