Installing System Font with Powershell

前端 未结 4 1245
悲哀的现实
悲哀的现实 2021-02-07 23:51

I have a folder filled with TTF files of custom fonts. I need to install them as system fonts using a powershell script (this is on Windows Server 2008 R2). Does anybody know

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-08 00:30

    It is quite simple. Take a look on the snippet below:

    $FONTS = 0x14
    $objShell = New-Object -ComObject Shell.Application
    $objFolder = $objShell.Namespace($FONTS)
    $objFolder.CopyHere("C:\test\Myfont.ttf")
    

    And it should not require to restart/logoff...

    The 0x14 value is the CLSID of the special folder.

    In addition I just found this tutorial explaining each step above:

    http://windowsitpro.com/scripting/trick-installing-fonts-vbscript-or-powershell-script

提交回复
热议问题