I want to get bit information for the Office installed by the command.

Asked 2 months ago, Updated 2 months ago, 2 views

I'd like to use the Windows command prompt to get information about whether the installed Office is 32-bit or 64-bit.

You can obtain the name and version of Office software installed with the following command. I didn't know how many bits it was.

wmic product where "Name like'%%Office%%'" get name, version

What commands can I use to get bit information?

The environment is Windows 10 Pro.

Thank you for your cooperation.

windows cmd ms-office

2022-09-30 11:51

1 Answers

In fact, there may be a single command, or it may be shorter, but if you put the following batches together, you will be able to make a decision.
Associate Windows File Extensions

@echo off
setlocal

.docx for rem association decision Word .xlsx for .docx Excel
for /f"tokens=2delims=="%%ain('assoc.docx')[email protected]=%%a
for /f"tokens=2delims=="%%ain('ftype%workrel%')do @setworkpath=%%a

If it's rem installation decision Word, it's a winword.exe If it's an Excel, it's an excel.exe
echo%workpath% | find/i "winword.exe" > NUL
if %errorlevel%geq1goto notinst

Determine if rem OS is 32-bit
if"%ProgramW6432%"=="goto x86

Determine if rem OS is 64-bit and Office is 64-bit
echo%workpath% | find/i "%ProgramFiles(x86)%"
if %errorlevel%geq1goto x64

—x86
The echo Office is a 32-bit version.
exit/b1

—x64
The echo Office is a 64-bit version.
exit/b2

—notinst
echo Office is not installed.
exit/b0


2022-09-30 11:51

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.