Remotely Install OpenType (.otf) or TrueType (.ttf) Fonts

A customer recently asked how he can use BatchPatch to deploy .otf and .ttf font files to remote computers. It’s a pretty simple and straightforward process. Below I’ll go through the steps.

  1. Create a folder on your computer, and then place all of your .otf and .ttf font files in it.
  2. Also create a new text file with a .cmd extension in that same directory. You may call the call the new file ‘Install Fonts.cmd’ or similar. You should now have a folder that looks something like the folder shown in the screenshot below:
    2016-02-22 17_30_38-FontsToDeploy
  3. Modify the contents of your .cmd file to include the necessary commands. In my script file below and in the screenshot you can see that I’ve simply taken the names of the font files and input them into the script contents accordingly:
    copy "MySpecialOpenTypeFont-Bold.otf" "%SystemRoot%\Fonts"
    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "MySpecialOpenTypeFont-Bold (OpenType)" /t REG_SZ /d MySpecialOpenTypeFont-Bold.otf /f
     
    copy "MySpecialOpenTypeFont-BoldItalic.otf" "%SystemRoot%\Fonts"
    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "MySpecialOpenTypeFont-BoldItalic (OpenType)" /t REG_SZ /d MySpecialOpenTypeFont-BoldItalic.otf /f
     
    copy "MySpecialOpenTypeFont-ExtraBold.otf" "%SystemRoot%\Fonts"
    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "MySpecialOpenTypeFont-ExtraBold (OpenType)" /t REG_SZ /d MySpecialOpenTypeFont-ExtraBold.otf /f
     
    copy "MySpecialTrueTypeFont-Bold.ttf" "%SystemRoot%\Fonts"
    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "MySpecialTrueTypeFont-Bold (TrueType)" /t REG_SZ /d MySpecialTrueTypeFont-Bold.ttf /f
     
    copy "MySpecialTrueTypeFont-BoldItalic.ttf" "%SystemRoot%\Fonts"
    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "MySpecialTrueTypeFont-BoldItalic (TrueType)" /t REG_SZ /d MySpecialTrueTypeFont-BoldItalic.ttf /f
     
    copy "MySpecialTrueTypeFont-ExtraBold.ttf" "%SystemRoot%\Fonts"
    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "MySpecialTrueTypeFont-ExtraBold (TrueType)" /t REG_SZ /d MySpecialTrueTypeFont-ExtraBold.ttf /f

    2016-02-22 17_30_29-E__Temp_FontsToDeploy_Install Fonts.cmd - Notepad++

  4. Once you have the .cmd script file created with the appropriate contents in the same folder as the actual .ttf and .otf files, you can create the deployment in BatchPatch. Highlight the desired hosts/rows, and then select ‘Actions > Deployment > Create/modify deployment.’
    2016-02-22 17_47_29-Deploy .msi .msp .msu .exe .reg .vbs .bat .cmd .ps1 etc
  5. You can see in the above screenshot that I have selected the ‘Install Fonts.cmd’ file, and I have checked the box that says “Copy entire directory…” When I click “Execute now” the folder that I created earlier containing the .otf and .ttf font files along with the ‘Install Fonts.cmd’ file will be copied to the target computers. BatchPatch will then remotely execute the ‘Install Fonts.cmd’ file, which will handle copying the .otf and .ttf files to the Windows Fonts directory along with creating the necessary registry entries for the new fonts. After successful execution, we see ‘Exit code: 0’ in BatchPatch.
    2016-02-22 17_53_56-new 1 - BatchPatch X1
  6. The final step is to reboot the target machines. The fonts will not be available to applications until after the reboot. You can use BatchPatch to send the reboot command by selecting the target hosts and then choosing ‘Actions > Reboot.’
    2016-02-22 17_55_03-new 1 - BatchPatch X1
This entry was posted in Blog, General, Tutorials and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.