PowerShell/Scripts/open-downloads-folder.ps1

25 lines
660 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
2022-01-29 12:47:46 +01:00
This PowerShell 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
.LINK
https://github.com/fleschutz/PowerShell
2022-01-29 12:47:46 +01:00
.NOTES
Author: Markus Fleschutz / License: CC0
2021-10-21 16:46:32 +02:00
#>
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
}