Created
September 16, 2023 03:47
-
-
Save mackenly/0fe587e8204fa943ee7429a5a4f96787 to your computer and use it in GitHub Desktop.
Install Fonts in a Particular Folder Using a PowerShell Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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