PowerShell/Scripts/cd-fonts.ps1

27 lines
611 B
PowerShell
Raw Normal View History

<#
.SYNOPSIS
Sets the working directory to the fonts folder
.DESCRIPTION
This PowerShell script changes the working directory to the fonts folder.
.EXAMPLE
PS> ./cd-fonts
2022-02-25 13:15:01 +01:00
📂C:\Windows\Fonts
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz / License: CC0
#>
try {
$Path = [Environment]::GetFolderPath('Fonts')
if (-not(Test-Path "$Path" -pathType container)) {
throw "Fonts folder at 📂$Path doesn't exist (yet)"
}
set-location "$Path"
"📂$Path"
exit 0 # success
} catch {
2022-04-13 12:06:32 +02:00
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}