|
本帖最后由 永远的大象 于 2017-12-14 21:02 编辑
额,如果你的C:\Program Files是系统默认的路径的话,可以用%ProgramFiles%代替,注册表里面定义好了的
如果一定要搜索的话,还是我最常用的命令:for
- for %%i in ( C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist "%%i:\Program Files\Microsoft Office\Office16\OSPP.VBS” Cscript "%%i:\Program Files\Microsoft Office\Office16\OSPP.VBS” /dstatus
复制代码
附送从KMS_VL_ALL提取的判断是否安装了OFFICE 2016 的方法:
- :: Check if Office 2016 products are ACTUALLY installed
- set /a _Office16=0
- for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\16.0\Common\InstallRoot /v Path" 2^>nul') do (
- set "_msi16=%%b"
- )
- for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\16.0\Common\InstallRoot /v Path" 2^>nul') do (
- set "_msi16wow=%%b"
- )
- for /f "tokens=2*" %%a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\ClickToRun /v InstallPath" 2^>nul') do (
- set "_ctr16=%%b\Office16"
- )
- if exist "%_msi16%\OSPP.VBS" (
- set /a _Office16=1
- ) else if exist "%_msi16wow%\OSPP.VBS" (
- set /a _Office16=1
- ) else if exist "%_ctr16%\OSPP.VBS" (
- set /a _Office16=1
- ) else if exist "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" (
- set /a _Office16=1
- ) else if exist "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" (
- set /a _Office16=1
- )
复制代码 |
|