使用 Powershell 安装系统字体 [英] Installing System Font with Powershell

查看:47
本文介绍了使用 Powershell 安装系统字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件夹,里面装满了自定义字体的 TTF 文件.我需要使用 powershell 脚本(这是在 Windows Server 2008 R2 上)将它们安装为系统字体.有人知道如何在powershell中做到这一点吗?谢谢!

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 how to do that in powershell? Thanks!

推荐答案

很简单.看看下面的片段:

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...

0x14 值是特殊文件夹的 CLSID.

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-安装字体-vbscript-or-powershell-script

这篇关于使用 Powershell 安装系统字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆