Skip to content

Instantly share code, notes, and snippets.

@markhallen
Created October 30, 2018 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markhallen/a65b02c56dcde9c07e4ba493c6a55600 to your computer and use it in GitHub Desktop.
Save markhallen/a65b02c56dcde9c07e4ba493c6a55600 to your computer and use it in GitHub Desktop.
Install font files in Windows 10. Font files should be in the same folder as the script file.
$shell = New-Object -ComObject Shell.Application
foreach ($font in $shell.Namespace($PSScriptRoot).Items()) {
if (($font.Path).ToLower() -like "*.ttf" -or ($font.Path).ToLower() -like "*.otf" -or ($font.Path).ToLower() -like "*.ttc") {
if (-not (Test-Path ($env:windir + "\Fonts\" + $font.Path.Split("\")[-1]) -ErrorAction SilentlyContinue)) {
$font.InvokeVerbEx("Install")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment