This is a little script that helps unattended installations to deploy and install multiple fonts in Windows 7
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 from 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 one of the fonts in the font source folder, the script prompts you with a re-install question. Thus, it gets interrupted and you have to run it with elevated rights.
Automatic Font Installation Script that works
Option Explicit
' Installing multiple fonts in Windows 7
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 exist"
End If