|
他这个把源EXE文件名称改成了WPS表格WPS文档WPS演示,批处理那里却没改。
@ECHO OFF
set "WpsDir=%~dp0office6"
set "WpsDirReg=%WpsDir:\=\\%"
if "%1"=="" (
call :Main
) else (
call :%1
if not "%2"=="SkipRefresh" (
assoc .=.
)
) >nul 2>nul
exit /b
:Main
REG QUERY "HKU\S-1-5-19">NUL 2>&1 || (powershell -Command "Start-Process '%~sdpnx0' -Verb RunAs"&& exit /b)
call "%~sdpnx0" Install
CLS&ECHO.&ECHO 完成 &TIMEOUT /t 2 >NUL&goto :eof
::执行创建注册表关联项
:Install
(
echo Windows Registry Editor Version 5.00
call :RegAssoc wps WPS文档 1
call :RegAssoc wpt WPS文档 2
call :RegAssoc doc WPS文档 1
call :RegAssoc dot WPS文档 1
call :RegAssoc rtf WPS文档 1
call :RegAssoc docx WPS文档 1
call :RegAssoc dotx WPS文档 2
call :RegAssoc docm WPS文档 1
call :RegAssoc dotm WPS文档 2
call :RegAssoc et WPS表格 1
call :RegAssoc ett WPS表格 2
call :RegAssoc xls WPS表格 1
call :RegAssoc xlt WPS表格 2
call :RegAssoc xlsx WPS表格 1
call :RegAssoc xlsm WPS表格 1
call :RegAssoc csv WPS表格 1
call :RegAssoc xltx WPS表格 2
call :RegAssoc xltm WPS表格 2
call :RegAssoc dps WPS演示 1
call :RegAssoc dpt WPS演示 2
call :RegAssoc ppt WPS演示 1
call :RegAssoc pot WPS演示 2
call :RegAssoc pps WPS演示 1
call :RegAssoc pptx WPS演示 1
call :RegAssoc pptm WPS演示 1
call :RegAssoc potx WPS演示 2
call :RegAssoc potm WPS演示 2
call :RegAssoc ppsx WPS演示 1
call :RegAssoc ppsm WPS演示 1
call :RegShellNew docx "DOCX 文档"
call :RegShellNew xlsx "XLSX 工作表" "%WpsDirReg%\\mui\\default\\templates\\newfile.xlsx"
call :RegShellNew pptx "PPTX 演示文稿"
) >"%Temp%\InstallWPS.reg"
reg import "%Temp%\InstallWPS.reg" >NUL 2>NUL
del /f "%Temp%\InstallWPS.reg" >NUL 2>NUL
for /d %%i in ("%WpsDir%\mui\*") do ren "%%i\lang.conf" lang.disabled.conf
ren "%WpsDir%\mui\zh_CN\lang.disabled.conf" lang.conf >NUL 2>NUL
goto :eof
::关联相关文件类型
:RegAssoc :: <%1=Ext> <%2=ExeName> <%3=IconIndex>
echo [HKEY_CLASSES_ROOT\WPS.%1\DefaultIcon]
echo @="%WpsDirReg%\\%2.exe,%3"
echo [HKEY_CLASSES_ROOT\WPS.%1\Shell\Open\Command]
echo @="\"%WpsDirReg%\\%2.exe\" \"%%1\""
echo [HKEY_CLASSES_ROOT\.%1]
echo @="WPS.%1"
goto :eof
::右键新建快捷方式
:RegShellNew :: <%1=Ext> <%2="FileDesc"> [%3="FilePath"]
echo [HKEY_CLASSES_ROOT\WPS.%1]
echo @=%2
echo [HKEY_CLASSES_ROOT\.%1\WPS.%1\ShellNew]
set "FilePathExists=_%3"
if "%FilePathExists:~2,-1%"=="" (
echo "NullFile"=""
) else (
echo "FileName"=%3
)
goto :eof
这是绿化.bat
|
|