OS detection script
I have just downloaded the two .msi installers for 7zip (x86 and x64). Does anyone have a simple script I can use to detect the OS and launch the appropriate .msi file?
0 Comments
[ + ] Show comments
Answers (5)
Answer Summary:
See my reply below
See my reply below
Please log in to answer
Posted by:
nivek03
12 years ago
If anyone's curious, this is how I ended up doing it:
Set WshShell = WScript.CreateObject("WScript.Shell") OSArchCheck = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE") If OSArchCheck = "x86" Then WshShell.Run "msiexec.exe /qn /i install_x86.msi /norestart" Else WshShell.Run "msiexec.exe /qn /i install_x64.msi /norestart" End If
Posted by:
aaronbaird1
12 years ago
@nivek03
I started using autohotkey for all my scripts because things like this are not easily possible using bat/cmd scripts. This is what I use to detect 32 bit on 64 bit architecture. (autohotkey scripting language)
IfExist, C:\Program Files (x86)\*
{
Run 64bit_App.msi
} else {
Run 32bit_App.msi
}
Simple.
Posted by:
dugullett
12 years ago
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto AMD64
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto AMD64
if "%PROCESSOR_ARCHITECTURE%"=="x86" goto x86 :AMD64 msiexec /i your_x64.msi /q exit :x86 msiexec /i your_x86.msi /q exit
Comments:
-
This seems good in concept, but I am more looking for the OS architecture as I have machines with 64 bit processors running 32 bit XP. Any ideas? - nivek03 12 years ago
Posted by:
Ifan
12 years ago
Posted by:
SMal.tmcc
12 years ago
look at: (see if it helps)
http://www.codeproject.com/Articles/73000/Getting-Operating-System-Version-Info-Even-for-Win