@ECHO OFF
cd /d "%~dp0"
tskill wpsoffice
::全局关联方式--------------------xls与et关联-----------------------------------------------------
::默认关联——如果不想改变现有默认关联，请注释掉
rem reg add "HKCR\.xls" /f /ve /t REG_SZ /d "et.xls.6"
::共存关联
reg add "HKCR\.xls\OpenWithProgids" /f /v "et.xls.6" /t REG_SZ /d ""

reg add "HKCR\et.xls.6\Application" /f /v "ApplicationDescription" /t REG_SZ /d "WPS表格 2019"
reg add "HKCR\et.xls.6\Application" /f /v "ApplicationIcon" /t REG_SZ /d "%~dp0office6\et.exe,0"

::共存关联时应用显示名称
reg add "HKCR\et.xls.6\Application" /f /v "ApplicationName" /t REG_SZ /d "WPS表格 2019"

reg add "HKCR\et.xls.6\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0office6\et.exe,0"
reg add "HKCR\et.xls.6\DocObject" /f /ve /t REG_SZ /d "0"
reg add "HKCR\et.xls.6\shell\open\command" /f /ve /t REG_SZ /d "\"%~dp0office6\et.exe\" \"%%1\""

::右键新建
reg add "HKCR\et.xls.6" /f /v "FriendlyTypeName" /t REG_SZ /d "WPS表格 2019"
rem reg add "HKCR\.xls\ShellNew" /f /v "NullFile" /t REG_SZ /d ""
rem reg add "HKCR\.xls\ShellNew" /f /v "IconPath" /t REG_SZ /d "%~dp0office6\et.exe,0"
::指定新建文件模板
rem reg add "HKCR\.xls\shellNew" /f /v "FileName" /t REG_SZ /d "%~dp0office6\empty.xls"
::------------------------------------------我是分隔符--------------------------------------------------

::全局关联方式--------------------xlsx与et关联-----------------------------------------------------
::默认关联——如果不想改变现有默认关联，请注释掉
rem reg add "HKCR\.xlsx" /f /ve /t REG_SZ /d "et.xlsx.6"
::共存关联
reg add "HKCR\.xlsx\OpenWithProgids" /f /v "et.xlsx.6" /t REG_SZ /d ""

reg add "HKCR\et.xlsx.6\Application" /f /v "ApplicationDescription" /t REG_SZ /d "WPS表格 2019"
reg add "HKCR\et.xlsx.6\Application" /f /v "ApplicationIcon" /t REG_SZ /d "%~dp0office6\et.exe,0"

::共存关联时应用显示名称
reg add "HKCR\et.xlsx.6\Application" /f /v "ApplicationName" /t REG_SZ /d "WPS表格 2019"

reg add "HKCR\et.xlsx.6\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0office6\et.exe,0"
reg add "HKCR\et.xlsx.6\DocObject" /f /ve /t REG_SZ /d "0"
reg add "HKCR\et.xlsx.6\shell\open\command" /f /ve /t REG_SZ /d "\"%~dp0office6\et.exe\" \"%%1\""

::右键新建
reg add "HKCR\et.xlsx.6" /f /v "FriendlyTypeName" /t REG_SZ /d "WPS表格 2019"
rem reg add "HKCR\.xlsx\ShellNew" /f /v "NullFile" /t REG_SZ /d ""
rem reg add "HKCR\.xlsx\ShellNew" /f /v "IconPath" /t REG_SZ /d "%~dp0office6\et.exe,0"
::指定新建文件模板
rem reg add "HKCR\.xlsx\shellNew" /f /v "FileName" /t REG_SZ /d "%~dp0office6\empty.xlsx"
::------------------------------------------我是分隔符--------------------------------------------------

::全局关联方式--------------------doc与wps关联-----------------------------------------------------
::默认关联——如果不想改变现有默认关联，请注释掉
rem reg add "HKCR\.doc" /f /ve /t REG_SZ /d "wps.doc.6"
::共存关联
reg add "HKCR\.doc\OpenWithProgids" /f /v "wps.doc.6" /t REG_SZ /d ""

reg add "HKCR\wps.doc.6\Application" /f /v "ApplicationDescription" /t REG_SZ /d "WPS文字 2019"
reg add "HKCR\wps.doc.6\Application" /f /v "ApplicationIcon" /t REG_SZ /d "%~dp0office6\wps.exe,0"

::共存关联时应用显示名称
reg add "HKCR\wps.doc.6\Application" /f /v "ApplicationName" /t REG_SZ /d "WPS文字 2019"

reg add "HKCR\wps.doc.6\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0office6\wps.exe,0"
reg add "HKCR\wps.doc.6\DocObject" /f /ve /t REG_SZ /d "0"
reg add "HKCR\wps.doc.6\shell\open\command" /f /ve /t REG_SZ /d "\"%~dp0office6\wps.exe\" \"%%1\""

::右键新建
reg add "HKCR\wps.doc.6" /f /v "FriendlyTypeName" /t REG_SZ /d "WPS文字 2019"
rem reg add "HKCR\.doc\ShellNew" /f /v "NullFile" /t REG_SZ /d ""
rem reg add "HKCR\.doc\ShellNew" /f /v "IconPath" /t REG_SZ /d "%~dp0office6\wps.exe,0"
::指定新建文件模板
rem reg add "HKCR\.doc\shellNew" /f /v "FileName" /t REG_SZ /d "%~dp0office6\empty.doc"
::------------------------------------------我是分隔符--------------------------------------------------

::全局关联方式--------------------docx与wps关联-----------------------------------------------------
::默认关联——如果不想改变现有默认关联，请注释掉
rem reg add "HKCR\.docx" /f /ve /t REG_SZ /d "wps.docx.6"
::共存关联
reg add "HKCR\.docx\OpenWithProgids" /f /v "wps.docx.6" /t REG_SZ /d ""

reg add "HKCR\wps.docx.6\Application" /f /v "ApplicationDescription" /t REG_SZ /d "WPS文字 2019"
reg add "HKCR\wps.docx.6\Application" /f /v "ApplicationIcon" /t REG_SZ /d "%~dp0office6\wps.exe,0"

::共存关联时应用显示名称
reg add "HKCR\wps.docx.6\Application" /f /v "ApplicationName" /t REG_SZ /d "WPS文字 2019"

reg add "HKCR\wps.docx.6\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0office6\wps.exe,0"
reg add "HKCR\wps.docx.6\DocObject" /f /ve /t REG_SZ /d "0"
reg add "HKCR\wps.docx.6\shell\open\command" /f /ve /t REG_SZ /d "\"%~dp0office6\wps.exe\" \"%%1\""

::右键新建
reg add "HKCR\wps.docx.6" /f /v "FriendlyTypeName" /t REG_SZ /d "WPS文字 2019"
rem reg add "HKCR\.docx\ShellNew" /f /v "NullFile" /t REG_SZ /d ""
rem reg add "HKCR\.docx\ShellNew" /f /v "IconPath" /t REG_SZ /d "%~dp0office6\wps.exe,0"
::指定新建文件模板
rem reg add "HKCR\.docx\shellNew" /f /v "FileName" /t REG_SZ /d "%~dp0office6\empty.docx"
::------------------------------------------我是分隔符--------------------------------------------------

::全局关联方式--------------------ppt与wpp关联-----------------------------------------------------
::默认关联——如果不想改变现有默认关联，请注释掉
rem reg add "HKCR\.ppt" /f /ve /t REG_SZ /d "wpp.ppt.6"
::共存关联
reg add "HKCR\.ppt\OpenWithProgids" /f /v "wpp.ppt.6" /t REG_SZ /d ""

reg add "HKCR\wpp.ppt.6\Application" /f /v "ApplicationDescription" /t REG_SZ /d "WPS演示 2019"
reg add "HKCR\wpp.ppt.6\Application" /f /v "ApplicationIcon" /t REG_SZ /d "%~dp0office6\wpp.exe,0"

::共存关联时应用显示名称
reg add "HKCR\wpp.ppt.6\Application" /f /v "ApplicationName" /t REG_SZ /d "WPS演示 2019"

reg add "HKCR\wpp.ppt.6\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0office6\wpp.exe,0"
reg add "HKCR\wpp.ppt.6\DocObject" /f /ve /t REG_SZ /d "0"
reg add "HKCR\wpp.ppt.6\shell\open\command" /f /ve /t REG_SZ /d "\"%~dp0office6\wpp.exe\" \"%%1\""

::右键新建
reg add "HKCR\wpp.ppt.6" /f /v "FriendlyTypeName" /t REG_SZ /d "WPS演示 2019"
rem reg add "HKCR\.ppt\ShellNew" /f /v "NullFile" /t REG_SZ /d ""
rem reg add "HKCR\.ppt\ShellNew" /f /v "IconPath" /t REG_SZ /d "%~dp0office6\wpp.exe,0"
::指定新建文件模板
rem reg add "HKCR\.ppt\shellNew" /f /v "FileName" /t REG_SZ /d "%~dp0office6\empty.ppt"
::------------------------------------------我是分隔符--------------------------------------------------

::全局关联方式--------------------pptx与wpp关联-----------------------------------------------------
::默认关联——如果不想改变现有默认关联，请注释掉
rem reg add "HKCR\.pptx" /f /ve /t REG_SZ /d "wpp.pptx.6"
::共存关联
reg add "HKCR\.pptx\OpenWithProgids" /f /v "wpp.pptx.6" /t REG_SZ /d ""

reg add "HKCR\wpp.pptx.6\Application" /f /v "ApplicationDescription" /t REG_SZ /d "WPS演示 2019"
reg add "HKCR\wpp.pptx.6\Application" /f /v "ApplicationIcon" /t REG_SZ /d "%~dp0office6\wpp.exe,0"

::共存关联时应用显示名称
reg add "HKCR\wpp.pptx.6\Application" /f /v "ApplicationName" /t REG_SZ /d "WPS演示 2019"

reg add "HKCR\wpp.pptx.6\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0office6\wpp.exe,0"
reg add "HKCR\wpp.pptx.6\DocObject" /f /ve /t REG_SZ /d "0"
reg add "HKCR\wpp.pptx.6\shell\open\command" /f /ve /t REG_SZ /d "\"%~dp0office6\wpp.exe\" \"%%1\""

::右键新建
reg add "HKCR\wpp.pptx.6" /f /v "FriendlyTypeName" /t REG_SZ /d "WPS演示 2019"
rem reg add "HKCR\.pptx\ShellNew" /f /v "NullFile" /t REG_SZ /d ""
rem reg add "HKCR\.pptx\ShellNew" /f /v "IconPath" /t REG_SZ /d "%~dp0office6\wpp.exe,0"
::指定新建文件模板
rem reg add "HKCR\.pptx\shellNew" /f /v "FileName" /t REG_SZ /d "%~dp0office6\empty.pptx"
::------------------------------------------我是分隔符--------------------------------------------------


::写入注册信息，以取消首次启动时的对话框
reg add "HKLM\SOFTWARE\WOW6432Node\Kingsoft\Office\6.0\Common" /f /v "hostprocname" /t REG_SZ /d "wpsoffice.exe"
::安装路径
reg add "HKLM\SOFTWARE\WOW6432Node\Kingsoft\Office\6.0\Common" /f /v "InstallRoot" /t REG_SZ /d "%~dp0\"
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Kingsoft Office" /f /v "LocationRoot" /t REG_SZ /d "%~dp0\"
reg add "HKCU\SOFTWARE\Classes\TypeLib\{7EA28F2F-D08B-4FE3-A88A-480640A2046B}\1.0\HELPDIR" /f /ve /t REG_SZ /d "%~dp0office6"
reg add "HKLM\SOFTWARE\Classes\TypeLib\{30E995E3-BD8B-42F1-8755-D6BEA44F9AD4}\1.0\HELPDIR" /f /ve /t REG_SZ /d "%~dp0office6"


::oem信息
Reg add "HKCU\SOFTWARE\Kingsoft\Office\6.0\common\UserInfo" /f /v "UserName" /t REG_SZ /d "wps"
Reg add "HKCU\SOFTWARE\Kingsoft\Office\6.0\common\UserInfo" /f /v "Company" /t REG_SZ /d "金山软件"
Reg add "HKCU\SOFTWARE\Kingsoft\Office\6.0\common\UserInfo" /f /v "Abbreviation" /t REG_SZ /d "Admin"
Reg add "HKCU\SOFTWARE\Kingsoft\Office\6.0\common\UserInfo" /f /v "LocateUserHaveSet" /t REG_DWORD /d "1"

rem 创建快捷方式
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""c:\Users\Public\Desktop\WPS文字.lnk""):b.TargetPath=""%~dp0office6\wps.exe"":b.WorkingDirectory=""%~dp0office6\"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""c:\Users\Public\Desktop\WPS演示.lnk""):b.TargetPath=""%~dp0office6\wpp.exe"":b.WorkingDirectory=""%~dp0office6\"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""c:\Users\Public\Desktop\WPS表格.lnk""):b.TargetPath=""%~dp0office6\et.exe"":b.WorkingDirectory=""%~dp0office6\"":b.Save:close")
if not exist "%appdata%\Microsoft\Internet Explorer\Quick Launch\办公工具"  md "%appdata%\Microsoft\Internet Explorer\Quick Launch\办公工具\"
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""%appdata%\Microsoft\Internet Explorer\Quick Launch\办公工具\WPS文字.lnk""):b.TargetPath=""%~dp0office6\wps.exe"":b.WorkingDirectory=""%~dp0office6\"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""%appdata%\Microsoft\Internet Explorer\Quick Launch\办公工具\WPS演示.lnk""):b.TargetPath=""%~dp0office6\wpp.exe"":b.WorkingDirectory=""%~dp0office6\"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""%appdata%\Microsoft\Internet Explorer\Quick Launch\办公工具\WPS表格.lnk""):b.TargetPath=""%~dp0office6\et.exe"":b.WorkingDirectory=""%~dp0office6\"":b.Save:close")



::激活信息
xcopy /s /q /y /r office6\setup\Kingsoft "%appdata%\Kingsoft\"
xcopy /s /q /y /r office6\setup\ProgramData "%ProgramData%\"

::安装公式编辑器字体
set zt=%ProgramData%\Kingsoft\office6\mtfont\mtextra.ttf
set zt=%zt:\=\\%
mshta "javascript:new ActiveXObject('Shell.Application').NameSpace(20).CopyHere('%zt%',0x0010);close()"
::公式编辑器自动初始化
start "" "%~dp0office6\mui\zh_CN\resource\ksee\EqnEdit.exe"