扔给你一个LibreOfficePortable for win 关联程序脚本

OOo,TeX,KO,ABI,GIMP,Picasa,ProE,QCAD,Inkscape,Kicad,Eagle
回复
zrqlx126
帖子: 400
注册时间: 2007-06-22 18:52

扔给你一个LibreOfficePortable for win 关联程序脚本

#1

帖子 zrqlx126 » 2017-01-03 11:13

警告:该脚本仅在xp系统下测试通过,不保证其他系统有效,出现任何问题,本人概不负责。
用法:复制下列代码,新建一个bat脚本,放置在LibreOfficePortable目录中,双击脚本,按照提示操作。

代码: 全选

@echo off

title Libreoffice关联程序

::pushd %~dp0

mode con cols=77 lines=21

color fc

:list
echo ###########################################
echo # 要关联请程序,请输入1,要删除关联,请输入0 #
echo ###########################################
set /p choice=请输入:

if not defined choice (
	goto list
) else (
	if "%choice%"=="1" goto install
	if "%choice%"=="0" goto remove
)

:install
::关联后缀
assoc .odb=LibreOfficePortable.odb
assoc .odf=LibreOfficePortable.odf
assoc .odg=LibreOfficePortable.odg
assoc .odm=LibreOfficePortable.odm
assoc .odp=LibreOfficePortable.odp
assoc .ods=LibreOfficePortable.ods
assoc .odt=LibreOfficePortable.odt
assoc .otg=LibreOfficePortable.otg
assoc .otp=LibreOfficePortable.otp
assoc .ots=LibreOfficePortable.ots
assoc .ott=LibreOfficePortable.ott

::创建文件类型
ftype LibreOfficePortable.odb="%~dp0LibreOfficeBasePortable.exe -o "%%1"
ftype LibreOfficePortable.odf="%~dp0LibreOfficeMathPortable.exe" -o "%%1"
ftype LibreOfficePortable.odg="%~dp0LibreOfficeDrawPortable.exe" -o "%%1"
ftype LibreOfficePortable.odm="%~dp0LibreOfficeWriterPortable.exe" -o "%%1"
ftype LibreOfficePortable.odp="%~dp0LibreOfficeImpressPortable.exe" -o "%%1"
ftype LibreOfficePortable.ods="%~dp0LibreOfficeCalcPortable.exe" -o "%%1"
ftype LibreOfficePortable.odt="%~dp0LibreOfficeWriterPortable.exe" -o "%%1"
ftype LibreOfficePortable.otg="%~dp0LibreOfficeDrawPortable.exe" -o "%%1"
ftype LibreOfficePortable.otp="%~dp0LibreOfficeImpressPortable.exe" -o "%%1"
ftype LibreOfficePortable.ots="%~dp0LibreOfficeCalcPortable.exe" -o "%%1"
ftype LibreOfficePortable.ott="%~dp0LibreOfficeWriterPortable.exe" -o "%%1"

::文件图标
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.odb\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,11"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.odf\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,12"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.odg\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,5"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.odm\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,9"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.odp\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,7"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.ods\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,3"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.odt\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,1"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.otg\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,6"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.otp\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,8"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.ots\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,4"
reg add "HKEY_CLASSES_ROOT\LibreOfficePortable.ott\DefaultIcon" /ve /t REG_SZ /d "%~dp0App\libreoffice\program\soffice.bin,2"

#退出
exit

:remove
::删除关联
assoc .odb=
assoc .odf=
assoc .odg=
assoc .odm=
assoc .odp=
assoc .ods=
assoc .odt=
assoc .otg=
assoc .otp=
assoc .ots=
assoc .ott=

::删除文件类型
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.odb" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.odf" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.odg" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.odm" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.odp" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.ods" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.odt" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.otg" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.otp" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.ots" /f
reg delete "HKEY_CLASSES_ROOT\LibreOfficePortable.ott" /f

::重新加载外壳 
taskkill /f /im explorer.exe
start explorer
谢宝良
帖子: 1983
注册时间: 2010-05-01 21:23

Re: 扔给你一个LibreOfficePortable for win 关联程序脚本

#2

帖子 谢宝良 » 2017-01-06 12:29

LibreOfficePortable 这垃圾安装到u盘,单单安装时间都要几个小时。更别说使用了。
回复