mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 13:04:59 +02:00
Add some open-*-folder.ps1 scripts
This commit is contained in:
24
Scripts/open-documents-folder.ps1
Executable file
24
Scripts/open-documents-folder.ps1
Executable file
@ -0,0 +1,24 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Opens the documents folder
|
||||
.DESCRIPTION
|
||||
This script launches the File Explorer with the user's documents folder.
|
||||
.EXAMPLE
|
||||
PS> ./open-documents-folder
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
try {
|
||||
$TargetDir = resolve-path "$HOME/Documents"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
throw "Documents folder at 📂$TargetDir doesn't exist (yet)"
|
||||
}
|
||||
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
Reference in New Issue
Block a user