Installing System Font with Powershell

前端 未结 4 1250
悲哀的现实
悲哀的现实 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:37

    Using the Shell.Application COM object doesn't work on Server Core (at least not on 2012 R2).

    I had success by simply copying the font file to C:\Windows\Fonts (in this case times.ttf) and then adding the corresponding registry entry with PowerShell:

    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' -Name 'Times New Roman (TrueType)' -PropertyType String -Value times.ttf
    

    Removal is the reverse of installation. The only downside is that a restart is required both after the font has been installed and also before it is uninstalled if an application has referenced it.

提交回复
热议问题