2023-10-31 12:48:22 +01:00
|
|
|
|
<#
|
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
|
2022-05-07 14:54:18 +02:00
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
2021-10-21 16:46:32 +02:00
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
try {
|
2022-05-07 14:54:18 +02:00
|
|
|
|
if ($IsLinux) {
|
|
|
|
|
$Path = Resolve-Path "$HOME/Downloads"
|
|
|
|
|
} else {
|
|
|
|
|
$Path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
2021-10-21 16:46:32 +02:00
|
|
|
|
}
|
2022-05-07 14:54:18 +02:00
|
|
|
|
if (-not(Test-Path "$Path" -pathType container)) {
|
|
|
|
|
throw "Downloads folder at 📂$Path doesn't exist (yet)"
|
|
|
|
|
}
|
|
|
|
|
& "$PSScriptRoot/open-file-explorer.ps1" $Path
|
2021-10-21 16:46:32 +02:00
|
|
|
|
exit 0 # success
|
|
|
|
|
} catch {
|
2022-04-13 12:06:32 +02:00
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-10-21 16:46:32 +02:00
|
|
|
|
exit 1
|
|
|
|
|
}
|