Skip to content

Instantly share code, notes, and snippets.

@robie2011
Created April 30, 2014 14:05
Show Gist options
  • Save robie2011/11428051 to your computer and use it in GitHub Desktop.
Save robie2011/11428051 to your computer and use it in GitHub Desktop.
Installing new Fonts on Windows with VBS
' http://blogs.technet.com/b/rspitz/archive/2010/09/25/how-to-install-a-font-from-the-command-line-on-windows-7.aspx
strPathFonts = "\\share\fonts"
set Shell = WScript.CreateObject("WScript.Shell")
strWindir = Shell.ExpandEnvironmentStrings("%windir%")
set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.GetFolder(strPathFonts)
Set fc = f.Files
For Each fl in fc
'wscript.echo strWindir + "\fonts\" +fl.name
if (fso.FileExists("C:\Windows\Fonts\" +fl.name)) then
'wscript.echo "existiert bereits"
else
'wscript.echo "install ..."
installFont strPathFonts, fl.name
end if
Next
function installFont(path, file)
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.Namespace(path)
set objFolderItem = objFolder.ParseName(file)
objFolderItem.InvokeVerb("Install")
end function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment