cloudtec GmbH
cloudtec Ltd., Switzerland
+41 31 528 04 55
www.cloudtec.ch

Install Font with Command line or Script in Windows 7

This is a little script that helps unattended installations to deploy and install multiple fonts in Windows 7

This is a little script that helps unattended installations to deploy and install multiple fonts in Windows 7

Why do you need a script to install fonts? Windows needs to install the font properly and write information to the registry; it is not enough to just copy the font to C:\Windows\Fonts.

To deploy your fonts, you simply have to launch the vbScript File from a command line or with your software distribution tool.

Make sure that the path to your font directory is accessible by the script. In case you have already installed one of the fonts in the font source folder, the script prompts you with a re-install question. Thus, it gets interrupted and you have to run it with elevated rights.

Automatic Font Installation Script that works with Windows 7

Option Explicit
' Installing multiple Fonts in Windows 7
' http://www.cloudtec.ch 2011

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 " Install Fonts "
Wscript.Echo "--------------------------------------"
Wscript.Echo " "

strFontSourcePath = "\\yourservername\share\fontsourcefolder\"

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

If you are a systems engineer you might also be interested in this article
Remote Assistance Windows 7 | Free Built-in Remote Control


Behalten Sie uns auf dem Radar

Um mehr über wegweisende Webtechnologien, aktuelle Projekte und News rund um cloudtec erfahren möchten, melden Sie sich für unseren Newsletter an.

* Wir versenden max. zwei pro Jahr

 Herr    Frau

MailChimp Benutzerhandbuch

MailChimp Benutzerhandbuch

Diese Dokumentation wurde für MailChimp Anwender geschrieben.…
Office 365 Passwort läuft nie ab

Office 365 Passwort läuft nie ab

Im Office 365 Admin Panel sucht man vergebens nach einer Checkbox…
Change Image with jquery mouse position

Change Image with jquery mouse position

How to animate images based on the cursor position using jQuery.

Kontakt

Webagentur
cloudtec GmbH
Sandrainstrasse 17
3007 Bern
SWITZERLAND

+41 31 528 04 55
info@cloudtec.ch