Cool Solutions

Automated Font Registration


July 30, 2009 4:58 pm





I needed a way to automate the distribution of fonts (TrueType) fonts via a script. I was surprised to discover that it’s not as easy as just copying the font files to the %windir%\fonts folder. Searching around on the Internet, I see that it’s not so uncommon to want to be able to do this, but surprisingly, I found no free solution for accomplishing this task – and the programmatic way is over my head.

Typically, to install and register a new Windows font, you have to use Explorer, browse to the Windows Fonts directory, then use the Install New Font… menu item.

However, I discovered something interesting. You can just copy the TTF files from DOS into the font directory (%windir%\fonts), then if you open explorer to the fonts directory the new fonts will automatically get registered. So, this could be scripted like this:

copy *.TTF %Windir%\fonts /y
explorer /e, %Windir%\fonts

And the fonts would successfully be added to the system. However, it isn’t exactly silent. The user is left with a Windows Explorer window open that they would need to then close.

I wanted a more silent way to do this. Same concept, except I launch explorer in a hidden window (using my RunHide program), then kill the process silently. Thus, you can silently add new fonts programmatically by:

copy *.TTF %Windir%\fonts
copy %windir%\explorer.exe %temp%\xpl.exe /y
runhide %temp%\xpl.exe /e,%windir%\fonts
ping localhost -n 5 >nul
taskkill /im xpl.exe /f

Kludgy, but it’ll work and without any user interaction (or notice).


  • The “ping” line causes a 5 second delay, time for explorer to launch
  • You will need to have Explorer configured to launch as a separate process for this solution to work:
0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Categories: Uncategorized


Disclaimer: This content is not supported by Micro Focus. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.


  1. By:jason_ee

    Another silent method I use is to distribute each font file and its registry entry. On Windows 2000 and XP, this is in the key HKLM/Software/Microsoft/Windows NT/CurrentVersion/Fonts. Each font has a string in the form of “visible name (font type) = font file name”. Note that this method requires handling each font individually and may require a logoff/on cycle or reboot in order for Windows to present the new font(s) to the user.

  2. By:grahamch

    I just had this issue (how to push out a font through NAL). I utilized the following script as a “Run before Distribution” script.

    set oApp = createobject(“shell.application”)

    cFonts = &H14&

    set oFontsFolder = oApp.namespace(cFonts)
    oFontsFolder.copyhere “==path to the location of the font file==”

  3. By:kellt900

    Interesting. Sounds strange wanting to delete fonts, but I mused this with some of my geeky colleagues. However interesting train of thoughts here that may apply down the line to other things.