-
Notifications
You must be signed in to change notification settings - Fork 13
/
InstallFonts.ps1
28 lines (26 loc) · 909 Bytes
/
InstallFonts.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
28
$FONTS = 0x14
$Path="./fonts"
$FontItem = Get-Item -Path $Path
$FontList = Get-ChildItem -Path "$FontItem\*" -Include ('*.fon','*.otf','*.ttc','*.ttf')
$objShell = New-Object -ComObject Shell.Application
$objFolder = $objShell.Namespace($FONTS)
$Fontdir = dir $Path
$username = $env:USERNAME
foreach($File in $FontList) {
if(!($file.name -match "pfb$")) {
$try = $true
$installedFonts = @(Get-ChildItem C:\Users\$username\AppData\Local\Microsoft\Windows\Fonts | Where-Object {$_.PSIsContainer -eq $false} | Select-Object basename)
$name = $File.baseName
foreach($font in $installedFonts) {
$font = $font -replace "_", ""
$name = $name -replace "_", ""
if ($font -match $name)
{
$try = $false
}
}
if ($try) {
$objFolder.CopyHere($File.fullname)
}
}
}