A quick command or script package to determine versions of Windows and Office

I need to audit software on more than 300 computers that are not on the same network or that belong to the same company.

Is there a command or a small program (which can be run without installation) that I can send an email to end users to run that will output versions of MS Windows and MS Office?

+6
source share
6 answers

One possible way to obtain the current version of Windows and the version of Microsoft Office is to query the registry entries using the command line.

To get the version of Windows using the registry, use the following command:

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName" 

This will produce a result that can be analyzed to get the current version / window name.

To get the current version of the office, use:

 reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer" 

The output of this command gives the Office version in numerical format, such as 14, 15, etc.

Parse the output to get the version number and match the list of existing versions of Microsoft Office to get the name of the installed version:

 Office 97 - 7.0 Office 98 - 8.0 Office 2000 - 9.0 Office XP - 10.0 Office 2003 - 11.0 Office 2007 - 12.0 Office 2010 - 14.0 Office 2013 - 15.0 Office 2016 - 16.0 

Hope this helps!

+16
source
 @echo off setlocal enableDelayedExpansion for /f "tokens=2 delims==" %%O in ('ftype ^|findstr /r /I "\\OFFICE[0-9]*" 2^>nul') do ( set "verp=%%~O" goto :end_for ) :end_for for %%P in (%verp%) do ( set "off_path=%%~dpP" for %%V in ("!off_path:~0,-1!") do ( set "office_version=%%~nV" goto :end_for2 ) ) :end_for2 echo %office_version% endlocal 

DOES NOT require administrator rights and works on Windows XP and higher

+1
source

I use this to capture versions 2003, 2007, 2010 and 2013.

 @echo off setlocal enabledelayedexpansion for /f "tokens=3 delims=." %%a in ('reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer"') do set reg=%%a set /ai=0 for %%b in (11 12 14 15) do ( if %%b == %reg% goto setver set /a i+=1 ) :setver set /an=0 for %%c in (2003 2007 2010 2013) do ( if !n! == !i! set ver=%%c && goto endloop set /a n+=1 ) :endloop echo Microsoft Version: %ver% echo. endlocal :end pause 
0
source

And 1 more, using the npocmaka code, but adding to the map to make it more convenient:

 @echo off setlocal call :GetOfficeVer endlocal exit /b :GetOfficeVer ::@echo off setlocal enableDelayedExpansion for /f "tokens=2 delims==" %%O in ( 'ftype ^|findstr /r /I "\\OFFICE[0-9]*" 2^>nul') do ( set "verp=%%~O" goto :end_for ) :end_for for %%P in (%verp%) do ( set "off_path=%%~dpP" for %%V in ("!off_path:~-3,2!") do ( set "off_ver=%%~nV" call :Map !off_ver! && exit /b ) ) :Map set "v=%1" set "map=11-2003;12-2007;14-2010;15-2013" call set v=%%map:*%v%-=%% set v=%v:;=&rem.% echo Microsoft Office Version: %v% endlocal exit /b 
0
source

To get the office version for Windows 10, it's pretty elegant:

 for /F "tokens=3 delims=." %%O in ('reg query HKEY_CLASSES_ROOT\Word.Application\CurVer') do set _officeVer=%%O 

It does not require administrator rights and also works on XP and above

0
source

The code above is "for / F" tokens = 3 delims =. "%% O in ('reg query HKEY_CLASSES_ROOT \ Word.Application \ CurVer') really sets _officeVer = %% O" works fine, but I also want to know if it's really a 32 or 64-bit version of Office. Is there an easy way to determine this?

0
source

Source: https://habr.com/ru/post/953889/


All Articles