Why do you need a script to install fonts? Windows needs to install the font properly and write information to the registry. It is not enough to just copy the font to C:\Windows\Fonts.
To deploy your fonts you simply have to launch the vbScript File form a command line or with your software distribution tool.
Make sure that the path to your font directory is accessible by the script. In case you have already installed on of the fonts in the font source folder, the script prompts with a re-install question. So it gets interrupted. You have to run it with elevated rights.
Automatic Font Installation Script that works with Windows 7
' Installing multiple Fonts in Windows 7
' http://www.cloudtec.ch 2011
Dim objShell, objFSO, wshShell
Dim strFontSourcePath, objFolder, objFont, objNameSpace, objFile
Set objShell = CreateObject("Shell.Application")
Set wshShell = CreateObject("WScript.Shell")
Set objFSO = createobject("Scripting.Filesystemobject")
Wscript.Echo "--------------------------------------"
Wscript.Echo " Install Fonts "
Wscript.Echo "--------------------------------------"
Wscript.Echo " "
strFontSourcePath = "\\yourservername\share\fontsourcefolder\"
If objFSO.FolderExists(strFontSourcePath) Then
Set objNameSpace = objShell.Namespace(strFontSourcePath)
Set objFolder = objFSO.getFolder(strFontSourcePath)
For Each objFile In objFolder.files
If LCase(right(objFile,4)) = ".ttf" OR LCase(right(objFile,4)) = ".otf" Then
If objFSO.FileExists("C:\Windows\Fonts\" & objFile.Name) Then
Wscript.Echo "Font already installed: " & objFile.Name
Else
Set objFont = objNameSpace.ParseName(objFile.Name)
objFont.InvokeVerb("Install")
Wscript.Echo "Installed Font: " & objFile.Name
Set objFont = Nothing
End If
End If
Next
Else
Wscript.Echo "Font Source Path does not exists"
End If
Remote Assistance Windows 7 | Free Built-in Remote Control




