mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-30 23:16:32 +02:00
41 lines
1.1 KiB
Markdown
41 lines
1.1 KiB
Markdown
The *install-fonts.ps1* Script
|
|
===========================
|
|
|
|
install-fonts.ps1
|
|
|
|
|
|
Parameters
|
|
----------
|
|
```powershell
|
|
|
|
|
|
[<CommonParameters>]
|
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
|
```
|
|
|
|
Script Content
|
|
--------------
|
|
```powershell
|
|
$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)* |