Monday, January 28, 2013

Widows: Installing font from batch script

Share at Facebook

The font folder of windows is a special folder. So copying a font file from commandline doesn't mean to install it properly(though it works when you copy using mouse or ctlr+c as explorer handle that specially). Here is the two steps those will help you to install any fonts from your batch script or commandline.

1) Copy the font file using copy or xcopy command. For example copying the MyFont.ttf to the windows font folder(normally c:\windows\font). %systemroot% holds the c:\windows path.

copy f:\MyFont.ttf %systemroot%\fonts

2) Now, add a registry value for the font(MyFont.ttf) to make sure it work smooth and perfectly.

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "MyFont (TrueType)" /t REG_SZ /d MyFont.ttf /f

Now its installed perfectly. Above two steps worked for me, and I hope it will work for you too.

Note: Make sure you are following the steps under Administrator privilege.

No comments: