PowerShell/Scripts/open-downloads-folder.ps1

25 lines
650 B
PowerShell
Raw Normal View History

2021-10-21 16:46:32 +02:00
<#
.SYNOPSIS
2021-10-23 16:18:45 +02:00
Opens the user's downloads folder
2021-10-21 16:46:32 +02:00
.DESCRIPTION
2021-10-28 07:36:33 +02:00
This script launches the File Explorer showing the user's downloads folder.
2021-10-21 16:46:32 +02:00
.EXAMPLE
2021-10-23 11:00:38 +02:00
PS> ./open-downloads-folder
2021-10-21 16:46:32 +02:00
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$TargetDir = resolve-path "$HOME/Downloads"
if (-not(test-path "$TargetDir" -pathType container)) {
throw "Downloads folder at 📂$TargetDir doesn't exist (yet)"
}
2021-10-23 11:02:20 +02:00
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
2021-10-21 16:46:32 +02:00
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}