Created
November 4, 2014 16:04
-
-
Save jonman364/2d3d0ded204a2e575764 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 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