Solution: Installing multiple Fonts in Windows VBS Script

Office Productivity | Microsoft
Author
Description
Installing multiple Fonts in Windows
Attachments
No attachments.
Solutions
Option Explicit
' Installing multiple Fonts in Windows

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")


strFontSourcePath = "SOURCE PATH"

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("%windir%\Fonts\" & objFile.Name) Then
   'Wscript.Echo "Font already installed: " & objFile.Name
  Else
   Set objFont = objNameSpace.ParseName(objFile.Name)
   objFont.InvokeVerb("Install")
   
   Set objFont = Nothing
  End If
 End If
Next
Else
 Wscript.Echo "Font Source Path does not exists"
End If

on December 10th, 2018 (9:04 pm)
What masters said
You must sign in to comment!!
All comments
This solution has not been commented yet.
We use cookies to give you the best possible experience on our site. By continuing to use the site you agree to our use of cookies. Find out more Accept