Set objShell=CreateObject("Shell.Application")
Set objWSH=CreateObject("WScript.Shell")
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set argv=WScript.Arguments
set objFsoFontFile=objFSO.GetFile(argv(0))
Set objFontFile=objShell.NameSpace(CStr(objFsoFontFile.ParentFolder)).ParseName(objFsoFontFile.Name)
Set objSysFontsDir=objShell.NameSpace("shell:fonts")
If argv.Length=1 Then
Call objSysFontsDir.CopyHere(objFontFile)
ElseIf argv(1)="/i" Then
strFontTitle=objCurrDir.GetDetailsOf(objFontFile,21) '这个地方调用explorer获得字体标题,非Vista可能不是21
Call objWSH.RegWrite("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" & strFontTitle & " (TrueType)",objFontFile.Path)
'需要重启才能生效,vbs无法调用API,sigh~~或许rundll32可以?
ElseIf argv(1)="/m" Then
objSysFontsDir.MoveHere(objFontFile)
ElseIf argv(1)="/r" Then
WScript.Echo "Not implemented"
Else
WScript.Echo "RegFont.vbs V1.0"
End If作者: kangyi 时间: 2008-7-4 06:18
已经用nsis脚本解决了,挺傻瓜的^^