请教一下各位,我Excel卡住就经常会被禁用DLL文件,我想快速解除禁用后再启用这个插件,自己的电脑我就可以用批处理启用,但是不知道怎么解除禁用,但是我换一台电脑用的是2016就无效了,不知道是不是注册列表不一样。我需要在2010以上的版本都通用,就是不知道怎么改,请教一下各位。
代码如下:- @echo off
- setlocal EnableExtensions EnableDelayedExpansion
-
- rem 检测Excel安装路径
- for /f "tokens=3" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" /v "ProductReleaseIDs"') do (
- set "version=%%i"
- )
- if not defined version (
- echo Could not determine installed Excel version.
- pause
- exit /b 1
- )
-
- rem 检测CE card文件夹路径
- set "ce_card_path=C:\Windows\SysWOW64\CE card"
- if not exist "%ce_card_path%" (
- echo CE card folder not found.
- pause
- exit /b 1
- )
-
- rem 添加workbook32.dll
- set "dll_path=%ce_card_path%\workbook32.dll"
- if exist "%dll_path%" (
- regsvr32 /s "%dll_path%"
- echo Successfully added workbook to Excel COM add-ins.
- ) else (
- echo %dll_path% not found.
- )
-
- rem 添加workbook64.dll
- set "dll_path=%ce_card_path%\workbook64.dll"
- if exist "%dll_path%" (
- regsvr32 /s "%dll_path%"
- echo Successfully added workbook to Excel COM add-ins.
- ) else (
- echo %dll_path% not found.
- )
-
- rem 启用workbook加载项
- set "progid=workbook"
- set "version=%version:.=.%"
- set "reg_key=HKEY_CURRENT_USER\Software\Microsoft\Office\%version%\Excel\Options"
- reg add "%reg_key%" /v "OPEN" /t REG_SZ /d "!%progid! /r" /f >nul
- if errorlevel 1 (
- echo Failed to enable workbook COM add-in.
- ) else (
- echo Successfully enabled workbook COM add-in.
- )
-
- echo Done.
- pause
复制代码
|