Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Installing fonts via command line/script

12 Oct 2009   #1

Installing fonts via command line/script

Windows 7 has apparently changed the way fonts are installed. I have a web page that I use that when visiting the page it looks to see if a file called barcode.exe is installed in a particular folder and if it is not present it downloads the file and executes it. The exe file is designed to place 2 carolina bar code fonts into C:\windows\fonts. This works with no issues in both Windows XP and Windows Vista but is not working in Windows 7. I can manually install these into Windows 7 font folder with no problem, but need to be able to do it automatically. Does anyone know an effective command line to use to place a font into the font folder in Windows 7? Thanks...

Jerry Mill

My System SpecsSystem Spec
13 Jan 2010   #2

windows 7

in my my .bat file, I run Font.vbs file.

rem Add files


Text code inside of Font.vbs file as follows:

' Fonts.cfg
' January 13, 2010
' ----------------------------------------------------------
Option Explicit

Dim objShell, objFolder

Const FONTS = &H14&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(FONTS)
objFolder.CopyHere "O:\BDARevit\Distra\architxt.ttf"

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(FONTS)
objFolder.CopyHere "O:\BDARevit\Distra\BlankSerif.ttf"

My System SpecsSystem Spec
03 Mar 2010   #3

Win7 and XP

Anyway to do this all within an existing batch file? Without launching a VB application?
My System SpecsSystem Spec

11 May 2010   #4

windows 7 ultimate

This doesn't work for me in windows 7 professional from a windows server 2003.

It works like I have no permission to write in that folder (like if I run a batch file).

There is some non-standard option that I have to enable?

Thank you
My System SpecsSystem Spec
11 May 2010   #5

Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86

When you install a font, all that you actually do is to copy the concerned .ttf file to the %systemroot%\fonts (in most cases that would simply be C:\windows\fonts) and add an entry in under the registry key
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts".

You can do this with a batch file as follows:

Rem fontinstall.bat
xcopy *.ttf %systemroot%\fonts
regedit /s font.reg

The font.reg would contain the following:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"fontname (TrueType)"="filename.ttf"

You would need to reboot to see the font.
My System SpecsSystem Spec
14 May 2010   #6

windows 7 ultimate

Not in windows 7!
You cannot access the font directory!
This is the problem!

Thanks anyway
My System SpecsSystem Spec
14 May 2010   #7

Windows 8.1 Pro RTM x64

Here's a batch file that should accomplish what you wish to achieve. Please note that, since you are accessing the HKLM branch of the registry, this MUST be run either from within an administrative account or from one that has been elevated to administrative privileges.

XCOPY <Source>.<ext> %systemroot%\fonts
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "<Fontname> (<Type>)" /t REG_SZ /d "<Filename>.<ext>" /f
You will need to provide the information in <red>.
My System SpecsSystem Spec
17 May 2010   #8

windows 7 ultimate

Thanks for the answers.

I put my frizquadratatt.ttf in the c:\ directory, then I create font.cmd

XCOPY c:\frizquadratatt.ttf %systemroot%\fonts
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "Fritz Quadrata TT (True Type)" /t REG_SZ /d "frizquadratatt.ttf" /f
then I launch font.cmd from my desktop clicking "run as administrator"

it works fine...but I still haven't the font installed!!

ok, ok I have to restart the pc (WHY ?!?!? If you can doubleclick on a .ttf file, say install and you are immediatly able to use it!?!? ther must be another way!!)

Now I put this script in my logon.cmd in the domain server and tell the active directory to run it...but it doesn't work!!

Thank again
My System SpecsSystem Spec
17 Jan 2012   #9

Windows XP 32-bit
How to install a font via the command line? ADD_Fonts.cmd

Here is a batch script to install Fonts in any Folder automatically.
Paste the following code in notepad and save it as "ADD_Fonts.cmd"
place the cmd file inside the folder of the fonts you want to install and run it or
add the source folder as a parameter. for example "ADD_fonts.cmd" C:\Folder 1\Folder 2\

it will install all the fonts automatically by copying them to the Windows Fonts Folder and creating the required Registry values for them

TITLE Adding Fonts..
REM Filename: ADD_Fonts.cmd
REM Script to ADD TrueType and OpenType Fonts for Windows
REM By Islam Adel
REM 2012-01-16

REM How to use:
REM Place the batch file inside the folder of the font files OR:
REM Optional Add source folder as parameter with ending backslash and dont use quotes, spaces are allowed
REM example "ADD_fonts.cmd" C:\Folder 1\Folder 2\

IF NOT "%*"=="" SET SRC=%*
ECHO Adding Fonts..
FOR /F %%i in ('dir /b "%SRC%*.*tf"') DO CALL :FONT %%i
REM shutdown -r -f -t 10 -c "Reboot required for Fonts installation"
ECHO Done!

SET FFILE=%~n1%~x1
IF "%~x1"==".otf" SET FTYPE=(OpenType)
IF "%~x1"==".ttf" SET FTYPE=(TrueType)


COPY /Y "%SRC%%~n1%~x1" "%SystemRoot%\Fonts\"
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "%FNAME% %FTYPE%" /t REG_SZ /d "%FFILE%" /f
My System SpecsSystem Spec
04 Mar 2014   #10

Windows 7 Ultimate x64

The best way to do this is to create a vbs script and run it from a command line. So open notepad and paste:
Const FONTS = &H14& 

 Set objShell = CreateObject("Shell.Application") 
Set objFolder = objShell.Namespace(FONTS)
objFolder.CopyHere "C:\Scripts\Myfont.ttf"
Just change C:\Scripts\Myfont.ttff to the current location of ttf file you want to install and that's the only thing you should have to replace, go to file and save as and make sure you save it as a .vbs file. Then just save the vbs script where ever you like and run the script via cmd or batch file. If you need multiple fonts installed just repeat the objFolder.CopyHere "C:\Scripts\Myfont.ttf" line at the end with each font name in the appropriate place.

I should also mention that the batch file or command should look like this:
cscript "C:\folder\InstallFont.vbs"
I've tried the first few answers on this forum to no avail and this is the only thing that has worked for me so I thought I'd share.

reference: Hey, Scripting Guy! How Can I Install Fonts Using a Script? - Hey, Scripting Guy! Blog - Site Home - TechNet Blogs
My System SpecsSystem Spec

 Installing fonts via command line/script

Thread Tools

Similar help and support threads
Thread Forum
Executing command line command anywhere ?
I want to create a setup whereas a command line command can be run from any directory/folder, without having to be in the directory/folder whereas the command line command resides ?
General Discussion
Command Line - Help
Hi Guy's and Girls, Just first off I've never been too good with CMD and only an Apprentice in my company I work for. Now something I've wanted to do for awhile was to make the following but I don't necassirealy I know how to do this in one batch file: I would need a Batch file that is...
General Discussion
Web Browser fonts changed after installing new fonts to computer
Recently I installed two fonts onto computer for Typography, and upon doing so the fonts changed on Google Chrome and Firefox to this bold font. It appears to be the default font as before, just in bold now. I've tried checking the browsers font settings, and they're at the settings they were...
Browsers & Mail
Command Line
Is there a cmd.exe /switch for “run as administrator” ? Thanks-
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 13:30.
Twitter Facebook