Here is my script based on How do I install a font from the Windows command prompt?
Dim WinFontDir
Dim SrcFontDir
WinFontDir = "C:\Windows\Fonts"
SrcFontDir = "..\fonts.test"
Set objShell = CreateObject("Shell.Application")
Set objFontFolder = objShell.Namespace(WinFontDir)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSrc = objFSO.GetFolder(SrcFontDir)
Set colFiles = objSrc.Files
For each objFile in colFiles
If objFSO.FileExists(WInFontDir + "\" + objFile.Name) Then
WScript.Echo objFile.Name
else
WScript.Echo "Copying " + objFile.Name
objFSO.CopyFile SrcFontDir + "\" + objFile.Name, WinFontDir + "\" + objFile.Name
Set objFolderItem = objFontFolder.ParseName(objFile.Name)
objFolderItem.InvokeVerb("Install") // <- exception
End If
Next
Basically I want to be able to iterate through a folder of fonts, and only copy and install if a font file does not exists in "C:\Windows\Fonts" in the first place.
But when it comes to this line objFolderItem.InvokeVerb("Install") I got this error message:
Object Required: 'objFolderItem'
What is the cause?