在nlite工作前精简输入法

首先声明,这个脚本存在问题!是代码的问题,不能正常工作,希望懂DOS的朋友帮忙调试一下!也可能这个脚本有的人见过!不在罗嗦,脚本如下:
******************************************************************
echo rip fareast ime
rem 把Unicode编码的intl.inf文件转换为UTF8编码,这样普通的程序可以用类似处理英文的方法来处理
copy i386\intl.inf intl.inf
recode u2..u8 intl.inf
rem 在intl.inf文件中搜索带有[ime]这样的行
findstr /i ^^\[.*ime intl.inf |findstr /i /V \[FE_CONIME\] | findstr /i /V \[EA_IME_SHARED\] >tmp.imerfall.txt
for /F “tokens=1,2,3* delims=[]” %%i in (‘findstr /i /V LGReg tmp.imerfall.txt’) do (sed -n -e /^^\[%%i\]/,/^^\[.*\]/p intl.inf | sed -e /^^\[.*\]/d -e /^^$/d)>>tmp.IMEfiles.txt
rem 找出所有和输入法相关的文件名字的注册表项存储为tmp.imeLGReg.txt,略过了英文的输入法的注册报条目
for /F “tokens=1,2,3* delims=[]” %%i in (‘findstr /i LGReg tmp.imerfall.txt’) do (
sed -n -e /^^\[%%i\]/,/^^\[.*\]/p intl.inf | sed -e /^^\[.*\]/d -e /^^$/d |findstr /V 00000804 |findstr /V 00000404 )>>tmp.imeLGReg.txt
rem 删除intl.inf中和ime相关的注册表项
fgrep -v -F -f tmp.imeLGReg.txt intl.inf>tmp.intl.inf
rem 删除可能存在的空格
if exist xxx.tmp.txt del /Q xxx.tmp.txt
for /F “eol=; tokens=1* delims=, ” %%x in (tmp.imefiles.txt) do @echo %%x>>xxx.tmp.txt
move /Y xxx.tmp.txt tmp.imefiles.txt

rem 把所有要删除的文件都存到allfilefordel.txt中
type tmp.imefiles.txt>>allfilefordel.txt
rem 从intl.inf删除对这些输入法文件的引用
findstr /V /i /B /G:tmp.imefiles.txt tmp.intl.inf>intl.inf
rem 把intl.inf转换为unicode编码
recode u8..u2 intl.inf
rem 覆盖在i386目录的intl.inf文件
rem move /Y INTL.INF I386\INTL.INF
rem 从txtsetup.sif删除对这些输入法文件的引用
findstr /V /i /B /G:tmp.imefiles.txt i386\txtsetup.sif>tmp.txtsetup.sif
move /Y tmp.txtsetup.sif i386\txtsetup.sif
rem 从dosnet.inf删除对这些输入法文件的引用
findstr /V /i /B /G:tmp.imefiles.txt i386\dosnet.inf>tmp.dosnet.inf
move /Y tmp.dosnet.inf i386\dosnet.inf
rem 复制HIVESYS.INF文件
copy I386\HIVESYS.INF HIVESYS.INF
rem 把HIVESYS.INF转换为utf8编码
recode u2..u8 HIVESYS.inf
rem 需要删除的注册表项
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\E0010804″>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\E0020804″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\E0030804″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\E0050804″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\E00E0804″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00010409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00010409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00010409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00020409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00020409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00020409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00030409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00030409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00030409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00040409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00040409″>>tmp.imereg.lst
echo HKLM,”SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00040409″>>tmp.imereg.lst
rem 从HIVESYS.INF中删除上面的注册表项
findstr /i /v /G:tmp.imereg.lst HIVESYS.INF >tmp.hivesys.inf
move /Y tmp.hivesys.inf hivesys.inf
rem 把hivesys.inf变换为unicode编码
recode u8..u2/21 hivesys.inf
rem 覆盖i386目录的 hivesys.inf
move /Y HIVESYS.INF I386\HIVESYS.INF
rem 删除临时文件
rem del tmp.*
*******************************************************************
经过几天的反复试验,发现这样几个问题:
1、intl.inf文件被篡改了格式,目前我用for可以将它改成原来的格式,我想我那步是多余的,因为我想象这样的语句本身就可以输出正确的格式:for /F “tokens=1,2,3* delims=[]” %%i in (‘findstr /i /V LGReg tmp.imerfall.txt’) do (sed -n -e /^^\[%%i\]/,/^^\[.*\]/p intl.inf | sed -e /^^\[.*\]/d -e /^^$/d)是不是因为参数的使用上有问题?
2、findstr /V /i /B /G:tmp.imefiles.txt i386\dosnet.inf>tmp.dosnet.inf 这句没能起到删除多余输入法字体的作用,不过查看文件有的确实是删除了!
tmp.imefiles.txt中给出的是这样的格式:
a15.tbl
a234.tbl
acode.tbl
msdayi.tbl
dayiptr.tbl
dayiphr.tbl
………………………..
WINZM.MB
在dosnet.inf中是这样的
d1,a15.tbl
d1,a234.tbl
d1,acode.tbl
d1,msdayi.tbl
d1,dayiptr.tbl
d1,dayiphr.tbl
………………………..
d1,WINZM.MB
如上语句没能装所有的符合tmp.imefile.inf的字体全部删除
其它问题还没做测试,请大家帮帮忙,修改一下这个脚本

Tags: ,

相关文章

现在评论本文