Add open-downloads.ps1

This commit is contained in:
Markus Fleschutz 2021-10-21 16:46:32 +02:00
parent e659cc2606
commit 2102b57921
5 changed files with 55 additions and 3 deletions

View File

@ -158,6 +158,7 @@ moon.ps1, Prints the current moon phase
mute-audio.ps1, Mutes the audio device
open-browser.ps1, Starts the default Web browser
open-calculator.ps1, Starts the calculator program
open-downloads.ps1, Opens the downloads folder
open-email-client.ps1, Starts the default email client
open-file-explorer.ps1, Starts the Microsoft File Explorer
open-netflix.ps1, Starts the Netflix app

Can't render this file because it has a wrong number of fields in line 91.

View File

@ -25,11 +25,11 @@ export-to-serenade.ps1 [[-WakeWord] <String>] [[-FilePattern] <String>] [[-Targe
Accept wildcard characters? false
-TargetFile <String>
Specifies the target file ("$HOME/.serenade/scripts/PowerShell.js" by default)
Specifies the target file ("$HOME/.serenade/scripts/custom.js" by default)
Required? false
Position? 3
Default value "$HOME/.serenade/scripts/PowerShell.js"
Default value "$HOME/.serenade/scripts/custom.js"
Accept pipeline input? false
Accept wildcard characters? false
@ -41,7 +41,7 @@ export-to-serenade.ps1 [[-WakeWord] <String>] [[-FilePattern] <String>] [[-Targe
## Example
```powershell
PS> ./export-to-serenade.ps1 Computer
⏳ Exporting 264 scripts to C:\Users\Markus/.serenade/scripts/PowerShell.js...
⏳ Exporting 264 scripts to C:\Users\Markus/.serenade/scripts/custom.js...
✔️ exported 264 PowerShell scripts to Serenade in 22 sec
```

26
Docs/open-downloads.md Normal file
View File

@ -0,0 +1,26 @@
## open-downloads.ps1 - Opens the downloads folder
This script starts the File Explorer with the downloads folder.
## Parameters
```powershell
open-downloads.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
## Example
```powershell
PS> ./open-file-explorer
```
## Notes
Author: Markus Fleschutz · License: CC0
## Related Links
https://github.com/fleschutz/PowerShell
*Generated by convert-ps2md.ps1 using the comment-based help of open-downloads.ps1*

View File

@ -113,6 +113,7 @@ Mega Collection of PowerShell Scripts
| [new-email.ps1](Scripts/new-email.ps1) | Starts the default email client to write a new email | [Help](Docs/new-email.md) |
| [open-browser.ps1](Scripts/open-browser.ps1) | Starts the default Web browser | [Help](Docs/open-browser.md) |
| [open-calculator.ps1](Scripts/open-calculator.ps1) | Starts the calculator program | [Help](Docs/open-calculator.md) |
| [open-downloads.ps1](Scripts/open-downloads.ps1) | Opens the downloads folder | [Help](Docs/open-downloads.md) |
| [open-email-client.ps1](Scripts/open-browser.ps1) | Starts the default email client | [Help](Docs/open-email-client.md) |
| [open-file-explorer.ps1](Scripts/open-file-explorer.ps1) | Starts the File Explorer | [Help](Docs/open-file-explorer.md) |
| [open-netflix.ps1](Scripts/open-netflix.ps1) | Starts the Netflix app | [Help](Docs/open-netflix.md) |

24
Scripts/open-downloads.ps1 Executable file
View File

@ -0,0 +1,24 @@
<#
.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
}