Skip to content

Instantly share code, notes, and snippets.

@jonman364
Created November 4, 2014 16:04
Show Gist options
  • Save jonman364/2d3d0ded204a2e575764 to your computer and use it in GitHub Desktop.
Save jonman364/2d3d0ded204a2e575764 to your computer and use it in GitHub Desktop.
' installfonts.vbs
' Installing multiple Fonts in Windows 7
Option Explicit
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 " Installing Fonts "
Wscript.Echo "--------------------------------------"
Wscript.Echo " "
strFontSourcePath = "C:\FONTDIR" ' Directory containing fonts to install
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
Set objFont = objNameSpace.ParseName(objFile.Name)
objFont.InvokeVerb("Install")
Wscript.Echo "Installed Font: " & objFont
Set objFont = Nothing
End If
Next
Else
Wscript.Echo "Font Source Path does not exists"
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment