-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-fonts.ps1
27 lines (19 loc) · 908 Bytes
/
add-fonts.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Installing cascadia code fonts (update them from https://github.com/microsoft/cascadia-code/releases)
$SourceDir = ".\supportfiles\fonts"
$Source = ".\supportfiles\fonts\*"
$Destination = (New-Object -ComObject Shell.Application).Namespace(0x14)
$TempFolder = "C:\Windows\Temp\Fonts"
# Create the source directory if it doesn't already exist
New-Item -ItemType Directory -Force -Path $SourceDir
New-Item $TempFolder -Type Directory -Force | Out-Null
Get-ChildItem -Path $Source -Include '*.ttf', '*.ttc', '*.otf' -Recurse | ForEach {
If (-not(Test-Path "C:\Windows\Fonts\$($_.Name)")) {
$Font = "$TempFolder\$($_.Name)"
# Copy font to local temporary folder
Copy-Item $($_.FullName) -Destination $TempFolder
# Install font
$Destination.CopyHere($Font, 0x10)
# Delete temporary copy of font
Remove-Item $Font -Force
}
}