mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-28 07:38:38 +01:00
Add some open-*-folder.ps1 scripts
This commit is contained in:
parent
531e38847d
commit
70d97b6e91
@ -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.
|
||||
|
||||
|
||||
|
24
Scripts/open-auto-start-folder.ps1
Executable file
24
Scripts/open-auto-start-folder.ps1
Executable 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
24
Scripts/open-desktop-folder.ps1
Executable 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
|
||||
}
|
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
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user