Click here to Skip to main content
15,662,478 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
as the title,I need to know which office bitness installed on my x64 pc.
I checked regedit and did not find any tip.

Maybe I can find the install path, and check the pe header, but it's Complicated, I want check in NSIS script, so the easier the better.

Any tips? thanks a lot in advance.
Updated 21-Jun-14 1:52am

If the executable files (winword.exe, excel.exe, outlook.exe, etc.) are located in "%SystemDrive%\Program Files", you have the 64-bits version.
If they are located in "%SystemDrive%\Program Files (x86)", you are dealing with the 32-bits one.

Indeed, if standard installation path is changed, this method won't work.
According to SO: How to programmatically detect 32-bit or 64-bit visio version is installed?[^], you have some more options:

- you can check in the registry whether corresponding keys exist in HKLM\Software\Microsoft\Office (64-bits) or HKLM\Software\Wow6432Node\Microsoft\Office (32-bits)

- you can use the GetBinaryType function[^]
Share this answer
BCN-163 21-Jun-14 8:51am    
if user change the default install path, this will not work. a little dispirited. thanks for your tip.
BCN-163 21-Jun-14 9:07am    
I find a solution from microsoft
but I can't call function MsiLocateComponent because it's not exported. keep going
phil.o 21-Jun-14 9:47am    
Please see my updated solution.
BCN-163 8-Jul-14 11:32am    
thanks very much, man
# Written for PowerShell
$ComObject = New-Object -ComObject excel.application
IF($ComObject.OperatingSystem -like "*32-bit*"){
Write-host "Do This for 32-Bit"
}ElseIf($ComObject.OperatingSystem -like "*64-bit*"){
Write-host "Do This for 64-Bit"
Share this answer

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

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