mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-29 06:37:50 +02:00
1.1 KiB
1.1 KiB
The install-fonts.ps1 Script
install-fonts.ps1
Parameters
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
Script Content
$sourceFolder = "D:\related\FONT"
$fontsFolder = "$env:SystemRoot\Fonts"
$fontFiles = Get-ChildItem -Path $sourceFolder -Filter *.ttf
foreach ($font in $fontFiles) {
$destination = "$fontsFolder\$($font.Name)"
Copy-Item -Path $font.FullName -Destination $destination -Force
$fontName = [System.IO.Path]::GetFileNameWithoutExtension($font.Name)
$fontRegistryPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
$fontType = "TrueType"
New-ItemProperty -Path $fontRegistryPath -Name "$fontName ($fontType)" -PropertyType String -Value $font.Name -Force
}
Write-Output "Fonts have been installed successfully."
(page generated by convert-ps2md.ps1 as of 01/29/2025 19:36:33)