-
-
Notifications
You must be signed in to change notification settings - Fork 545
Expand file tree
/
Copy pathcd-fonts.ps1
More file actions
executable file
·29 lines (27 loc) · 694 Bytes
/
cd-fonts.ps1
File metadata and controls
executable file
·29 lines (27 loc) · 694 Bytes
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
29
<#
.SYNOPSIS
Sets the working dir to the fonts folder
.DESCRIPTION
This PowerShell script sets the current working directory to the fonts folder.
.EXAMPLE
PS> ./cd-fonts.ps1
📂C:\Windows\Fonts with 12 font files entered.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
$path = [Environment]::GetFolderPath('Fonts')
if (-not(Test-Path "$path" -pathType container)) {
throw "No fonts folder at: $path"
}
Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory
"📂$path with $($files.Count) font files entered."
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
exit 1
}