Install Fonts in Windows with an action

Anyone have examples of Installing Fonts in Windows with an action?


This seems promising: http://code.kliu.org/misc/fontreg/

This is helpful: http://superuser.com/questions/201896/how-do-i-install-a-font-from-the-windows-command-prompt


References:

Windows

Mac

Related Posts:

2 Likes

There may be a better way to do this but I found by uploading the font and then utilizing an install script I was able to accomplish this. Below is my action script for installing a font:

prefetch XXX

if {not exists folder “C:\software”}
waithidden cmd /c mkdir "C:\software"
endif
if {exists “c:\software\fontinstall.vbs”}
delete "c:\software\fontinstall.vbs"
endif

extract ffb5e7ce2aa9e89dfe4d6a69f632ccf536cae87b "c:\software"
delete __createfile
createfile until EOF
Set ofso = CreateObject(“Scripting.FileSystemObject”)
SourceFolder = ofso.GetParentFolderName(Wscript.ScriptFullName)

Const FONTS = &H14&

Set objShell = CreateObject(“Shell.Application”)
Set oSource = objShell.Namespace(SourceFolder)
Set oWinFonts = objShell.Namespace(FONTS)

’ Lame VBscript needs 4 f*ing lines instead of "if (/.ttf$/i) " …
Set rxTTF = New RegExp
rxTTF.IgnoreCase = True
rxTTF.Pattern = “.ttf$”

FOR EACH FontFile IN oSource.Items()
IF rxTTF.Test(FontFile.Path) THEN
oWinFonts.CopyHere FontFile.Path
END IF
NEXT
EOF
copy __createfile "c:\software\fontinstall.vbs"
waithidden cmd /c “c:\software\fontinstall.vbs”

1 Like

I know this is an old question but wanted to post the solution we used for Windows font deployment since this post is where I began our search… In the end, I chose to use jgstew’s first suggestion (http://code.kliu.org/misc/fontreg/) as part of the solution.

Wrote some simple ActionScript & DOS commands to move fonts and create a directory to run the FontReg.exe from. There may be a better way to do this, but this is what worked best for our multiple font deployment. I will also note that I wanted to run FontReg.exe only to register the fonts (instead of pushing FontReg.exe /move, I used ActionScript & DOS to do all the copying/moving of files - easier to narrow down errors during debugging and can file glob in DOS). If anybody comes up with a simpler solution or something with less lines of code, share what worked for you! Anyway, enjoy ~ Hope this helps someone along the way.

My prefetch file included multiple *.otf and *.ttf font files as well as FontReg_x64.exe (64bit) and FontReg.exe (32bit).

ActionScript:
prefetch xxxxxx sha1:xxxx size:xxxx http://xxxxxx:xxxx/Uploads/xxxxxx/Fonts.tmp sha256:xxxx
extract xxxxxx

//if folder doesn't exist then create it
if {not exists folder "C:\directory"}
folder create "C:\directory"
endif

//if os is 64bit and exe does not exist then move 64bit version else test exists and move 32 bit version
if {x64 of operating system and not exists file "C:\directory\FontReg.exe"} 
move __Download\FontReg_x64.exe C:\directory\FontReg.exe 
elseif {not exists file "C:\directory\FontReg.exe"}
move __Download\FontReg.exe C:\directory\FontReg.exe 
endif 

//use xcopy to copy fonts from download folder to windows font folder and overwrites files if exists already

//debugging
dos xcopy __Download\*tf C:\Windows\Fonts\ /C /Q /Y & ping 127.0.0.1 -n 2 > nul & echo Moving Fonts... & C:\directory\FontReg.exe & echo Registering Fonts... & ping 127.0.0.1 > nul

//production
//dos xcopy __Download\*tf C:\Windows\Fonts\ /C /Q /Y & C:\directory\FontReg.exe

Hi,
I have tried the following suggestions here but am having issues.
Has a simpler solution been found?

See Need to install Custom Windows Fonts