Monday, January 4, 2010

Installing Fonts Using Batch Files

Installing fonts is not really common task performing every day by thousands of people. Still one day you can understand that you are to install fonts with help of batch scripting. Fortunately it's really won't take a lot of time to create a batch file to install several fonts. You should just copy them into Fonts directory and add some keys to the Registry. Here is the batch script you are to execute:
copy font.ttf %systemroot%\fonts
regedit /s font.reg
The only trouble is that you have to create REG-file first. It will take a few moments to add the following lines to font.reg:
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"Font Name"="font.ttf"

Put down the real name of your font instead of "Font name" (leave commas). Also don't forget to reboot after the font's installation. That's all!

5 comments:

  1. Yes, if you really know that files that you are going to install are font-files.

    ReplyDelete
  2. Suppose I wanted to install multiple fonts (And I Do!). Would the command go like:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
    "Font Name1"="font1.ttf"
    "Font Name2"="font2.ttf"


    OR


    If I had several files for 1 font, what can I do? For instance, the font 'IskoolPota' has 2 font files when I copied them out of the Fonts folder. So I'm guessing something like:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
    "IskoolPota"="iskpota.ttf", "iskpotb.ttf"


    -would this work? Am I close?? Please, I kinda really needed to figure this out before office this Sunday :PP!!

    ReplyDelete
  3. Yes, you can use several fonts per REG file:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
    "Font Name1"="font1.ttf"
    "Font Name2"="font2.ttf"

    The same file should be used to install two different files for a single font:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
    "IskoolPota"="iskpota.ttf"
    "IskoolPotb"="iskpotb.ttf"

    ReplyDelete
  4. Why would you edit the registry?
    I just pasted a new font in the \fonts folder and after a reboot,
    it could be used in WordPad.

    ReplyDelete

Translate