PowerShell/Scripts/open-downloads.ps1
2021-10-21 16:46:32 +02:00

25 lines
614 B
PowerShell
Executable File

<#
.SYNOPSIS
Opens the downloads folder
.DESCRIPTION
This script starts the File Explorer with the downloads folder.
.EXAMPLE
PS> ./open-file-explorer
.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)"
}
start-process explorer.exe "$TargetDir"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}