Skip to content

Instantly share code, notes, and snippets.

@mackenly
Created September 16, 2023 03:47
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 mackenly/0fe587e8204fa943ee7429a5a4f96787 to your computer and use it in GitHub Desktop.
Save mackenly/0fe587e8204fa943ee7429a5a4f96787 to your computer and use it in GitHub Desktop.
Install Fonts in a Particular Folder Using a PowerShell Script
function Install-Font {
param(
[string]$fontPath
)
$shell = New-Object -ComObject Shell.Application
$folder = $shell.Namespace(0x14)
$folder.CopyHere($fontPath)
}
function Install-FontsInFolder {
param(
[string]$folderPath
)
Get-ChildItem -Path $folderPath -Recurse -File -Include *.ttf,*.otf,*.woff,*.eot,*.woff2 | ForEach-Object {
Install-Font -fontPath $_.FullName
}
}
# Set the path to the folder containing the fonts
$fontFolderPath = "C:\Users\you\Downloads\whatever"
# Call the function to install the fonts
Install-FontsInFolder -folderPath $fontFolderPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment