Deploy Fonts to Your Computers

Deploy fontsDid you know you can silently deploy fonts to your computers? Using a script, you can quickly and easily deploy fonts to as many computers as you need to within your business.

Sometimes we get surprised by the awesome things our customers use our products for. Emil Johanssen posted this response to a question on our support site. “How do I push fonts to a workstation?” Thanks, Emil for this awesome response! Below is his script.

How to Deploy Fonts

  1. Create a script called ADD_Fonts.cmd (or something else of your choosing, just be consistent) and save it in the same folder as the font files you want to install. Alternatively, if you do not want to save the .cmd and fonts in the same folder, you can modify the script to reference the path where the fonts are located. Read Emil’s comments for further instruction on correct formatting
  2. To apply the changes you will need to reboot the machine. You can use the provided command in the script:
    shutdown -r -f -t 10 -c "Reboot required for Fonts installation"
    (remove the REM from applicable commands) to have the script run the reboot.
  3. Create a New Package, the default Install Step should be in place. Add ADD_Fonts.cmd in the Install File field. Check “Include Entire Directory” (unless you are modifying your script to find the fonts in another directory) Blog_-_Add_Fonts_-_Install_Step If you do not have a reboot within your script (see step 2) remember to add in a reboot step (requires Pro or higher).

ADD_Fonts.cmd

@ECHO OFF
TITLE Adding Fonts..
REM Filename: ADD_Fonts.cmd
REM Script to ADD TrueType and OpenType Fonts for Windows

REM How to use:
REM Place the batch file inside the folder of the font files OR:
REM Optional Add source folder as parameter with ending backslash and dont use quotes, spaces are allowed
REM example "ADD_fonts.cmd" C:\Folder 1\Folder 2\

IF NOT "%*"=="" SET SRC=%*
REM ECHO.
REM ECHO Adding Fonts..
REM ECHO.
FOR /F %%i in ('dir /b "%SRC%*.*tf"') DO CALL :FONT %%i
REM OPTIONAL REBOOT
REM shutdown -r -f -t 10 -c "Reboot required for Fonts installation"
REM ECHO.
REM ECHO Done!
REM PAUSE
EXIT

:FONT
ECHO.
REM ECHO FILE=%~f1
SET FFILE=%~n1%~x1
SET FNAME=%~n1
SET FNAME=%FNAME:-= %
IF "%~x1"==".otf" SET FTYPE=(OpenType)
IF "%~x1"==".ttf" SET FTYPE=(TrueType)

ECHO FILE=%FFILE%
ECHO NAME=%FNAME%
ECHO TYPE=%FTYPE%

COPY /Y "%SRC%%~n1%~x1" "%SystemRoot%\Fonts\"
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "%FNAME% %FTYPE%" /t REG_SZ /d "%FFILE%" /f
GOTO :EOF

Modifications to Make

If you’re familiar with scripting, you’ll notice ECHO is commented out (REM) throughout, remove these where you would like an ECHO to be able to check each step run within the script. (This is handy for any troubleshooting you might need to do.)

As noted in Step 2, the restart is commented out. You can leave commented out or remove the following from the script to not have a restart.

REM OPTIONAL REBOOT
shutdown -r -f -t 10 -c "Reboot required for Fonts installation"
ECHO.
ECHO Done!
PAUSE
EXIT

You do need to restart your machines to apply the changes, if you don’t use a script to do so you can add a Reboot step to your deployment package (multiple steps are a Pro and Enterprise-level feature, you can get a free trial of Enterprise here.)