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

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_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts. This can be automated with a batch file as follows

Rem fontinst.bat
copy akbar.ttf %systemroot%\fonts
regedit /s font.reg

The font.reg would contain the following:

REGEDIT4
\[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\]
"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_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts 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:\WINNT\WIN.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_?"

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish