viernes, 1 de marzo de 2019

How can I install a font from a batch file?

When you install a font all it does is copy the .ttf file to 
%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:
install.bat:
xcopy font_name.ttf %systemroot%\fonts
regedit /s font.reg
If you want to install with administrator's rights:
runas /user:domain\userID "xcopy CHL_AVON_CG.ttf %systemroot%\fonts"
regedit /s font.reg
font.reg:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\]
"CoalhandLuke_Avon_CG (TrueType)"="CHL_AVON_CG.ttf"

No hay comentarios:

Publicar un comentario