PowerShell/scripts/cd-fonts.ps1

27 lines
611 B
PowerShell
Raw Normal View History

2024-10-01 15:11:03 +02:00
<#
.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
2022-05-04 11:50:18 +02:00
Author: Markus Fleschutz | License: CC0
#>
try {
2024-10-30 13:19:56 +01:00
$path = [Environment]::GetFolderPath('Fonts')
if (-not(Test-Path "$path" -pathType container)) {
throw "Fonts folder at 📂$path doesn't exist (yet)"
}
2024-10-30 13:19:56 +01:00
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
}