Command Line -- Microsoft Office Version
- by Vince
-
in Blog
-
Hits: 6378
I needed to quickly gather the version of Microsoft Office in a mixed version environment. Simple enough, let's grab the version of Word:
reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer"
The response output:
HKEY_CLASSES_ROOT\Word.Application\CurVer
(Default) REG_SZ Word.Application.15
Word 15 = Office 2013
Not that you couldn't have a mixed application environment but odds are good that the whole suite is Office 2013.
Great, but what can I do with this information if it just outputs to a command prompt? I can redirect it to a file server share, perhaps? But if I'm doing this for multiple workstations, I need to make the file name unique but identifiable:
reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer" > \\SERVERNAME\SHARENAME\%computername%.txt
The filename will name reflect the computer name.
You could toss this into a login script and get your collection of uniquely labelled files but you wouldn't want to open each file. You can gather each group of computers by version with the following:
findstr .14 *.txt
findstr .15 *.txt
.14 for Office 2010 and .15 for Office 2013 -- adjust accordingly.
You could even redirect that output to a file by adding:
> office2010.txt
> office2013.txt
... to the end of the findstr command.