Windows – How to install a font from the Windows command prompt

command linefontsinstallationwindows

Is it possible to install fonts from the command prompt on Windows? If yes, what is the command?

I tried copy [fontname].ttf C:\Windows\Fonts\ and it said copying was complete, but I could neither find the said fonts in the Fonts folder nor find them in the font list of any program so that certainly didn't work. (Although I was able to delete the said fonts from the Fonts folder afterwards)

Best Answer

It's possible but you have to write a Windows shell script to do that. Copying alone won't install the font: you also need to register the font, e.g.

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

Alternatively you can the following lines of code to suit your needs; save it as a .vbs file and then execute it.

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("<Folder or Share Location>")
Set objFolderItem = objFolder.ParseName("<TTF File Name>")
objFolderItem.InvokeVerb("Install")

Example:

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\Windows\Font")
Set objFolderItem = objFolder.ParseName("Myriad Pro.ttf")
objFolderItem.InvokeVerb("Install")

Yet another alternative is to install fonts "temporary", just for current user session. The idea is to run fontview.exe for each font, which makes it available for other Windows applications:

for /F "delims=;" %%a in ('dir C:\ExtraFonts /B /A-D-H-S /S') do fontview %%a

See the complete solution here.