How can I install a font from the command line/batch file?

Learn how to install a font from the command line/batch file.

John Savill

March 4, 1999

1 Min Read
How can I install a font from the command line/batch file?

A. When you install a font all it does is copy the .ttf file to the %systemroot%fonts and add an entry in HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionFonts. This can be automated with a batch file as follows

Rem fontinst.batcopy akbar.ttf %systemroot%fontsregedit /s font.reg

The font.reg would contain the following:

REGEDIT4
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionFonts]"Akbar Plain (TrueType)"="akbar.ttf"

In this example it copies akbar.ttf which is called "Akbar Plain (TrueType)" (yes its the Simpsons font ;-) ). The reg scipt actually creates a value called "Akbar Plain (TrueType)" under HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionFonts with its contents "akbar.ttf". The new font would be visable once the machine has been rebooted.

If you have some older 16bit applications you may want to add the font to win.ini as well in the [fonts] section. This could be accomplished using a .inf file, e.g.

[UpdateInis]"E:WINNTWIN.INI","Fonts",,"Akbar Plain (TrueType)=akbar.ttf"

 

See also, "Can I install a font from a cmd prompt or a batch file?" and "Q: How can I cause the ADD Fonts wizard to only display fonts with file name extension .FON and.FO_?"

About the Author(s)

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like