Add some open-*-folder.ps1 scripts

This commit is contained in:
Markus Fleschutz 2021-11-29 14:26:20 +01:00
parent 531e38847d
commit 70d97b6e91
5 changed files with 75 additions and 3 deletions

View File

@ -42,7 +42,7 @@ Computer, open `name` drive
Computer, open `name` folder
--------------------------
* launches the File Explorer with the given folder.
* replace `name` by: "downloads", "dropbox", "home", "music", "pictures", "repos", or "videos".
* replace `name` by: "autostart", "desktop", "documents", "downloads", "dropbox", "home", "music", "pictures", "recycle bin", "repos", or "videos".
* when finished use: *Computer, close file explorer* to close the File Explorer.

View File

@ -0,0 +1,24 @@
<#
.SYNOPSIS
Opens the autostart folder
.DESCRIPTION
This script launches the File Explorer with the user's autostart folder.
.EXAMPLE
PS> ./open-auto-start-folder
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$TargetDir = resolve-path "$HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
if (-not(test-path "$TargetDir" -pathType container)) {
throw "Autostart 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
}

24
Scripts/open-desktop-folder.ps1 Executable file
View File

@ -0,0 +1,24 @@
<#
.SYNOPSIS
Opens the desktop folder
.DESCRIPTION
This script launches the File Explorer with the user's desktop folder.
.EXAMPLE
PS> ./open-desktop-folder
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$TargetDir = resolve-path "$HOME/Desktop"
if (-not(test-path "$TargetDir" -pathType container)) {
throw "Desktop 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
}

View 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
}

View File

@ -1,10 +1,10 @@
<#
.SYNOPSIS
Opens the user's recycle bin folder
Opens the recycle bin folder
.DESCRIPTION
This script launches the File Explorer with the user's recycle bin folder.
.EXAMPLE
PS> ./open-recycle-bin
PS> ./open-recycle-bin-folder
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK