Added the script for adding fonts to the system by giving a source folder.

This commit is contained in:
Arash-Seifi
2025-01-29 19:43:42 +03:30
parent eb8ba5bdfc
commit 13244e37fe
3 changed files with 68 additions and 0 deletions

41
docs/install-fonts.md Normal file
View File

@ -0,0 +1,41 @@
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)*