Add open-one-drive-folder.ps1

This commit is contained in:
Markus Fleschutz 2021-11-30 14:57:46 +01:00
parent c5a3bf0608
commit 710ff06e9d
5 changed files with 32 additions and 38 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: "autostart", "desktop", "documents", "downloads", "dropbox", "home", "music", "pictures", "recycle bin", "repos", or "videos".
* replace `name` by: "Autostart", "Desktop", "Documents", "Downloads", "Dropbox", "Home", "Music", "OneDrive", "Pictures", "Recycle bin", "Repos", or "Videos".
* when finished say: *Computer, close file explorer* to close the File Explorer.

View File

@ -1,15 +0,0 @@
<#
.SYNOPSIS
Closes Microsoft's OneDrive
.DESCRIPTION
This script closes Microsoft's OneDrive gracefully.
.EXAMPLE
PS> ./close-one-drive
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
& "$PSScriptRoot/close-program.ps1" "Microsoft OneDrive" "onedrive" "onedrive.exe"
exit 0 # success

View File

@ -1,8 +1,8 @@
<#
.SYNOPSIS
Opens the user's Dropbox folder
Opens the Dropbox folder
.DESCRIPTION
This script launches the File and showing the user's Dropbox folder.
This script launches the File Explorer with the user's Dropbox folder.
.EXAMPLE
PS> ./open-dropbox-folder
.NOTES
@ -12,12 +12,12 @@
#>
try {
$TargetDir = resolve-path "$HOME/Dropbox"
if (-not(test-path "$TargetDir" -pathType container)) {
throw "Dropbox folder at 📂$TargetDir doesn't exist (yet)"
$TargetDirs = resolve-path "$HOME/Dropbox*"
foreach($TargetDir in $TargetDirs) {
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
exit 0 # success
}
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
exit 0 # success
throw "No Dropbox folder at 📂$HOME/Dropbox"
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1

View File

@ -0,0 +1,24 @@
<#
.SYNOPSIS
Opens the OneDrive folder
.DESCRIPTION
This script launches the File Explorer with the user's OneDrive folder.
.EXAMPLE
PS> ./open-one-drive-folder
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$TargetDirs = resolve-path "$HOME/OneDrive*"
foreach($TargetDir in $TargetDirs) {
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
exit 0 # success
}
throw "No OneDrive folder at 📂$HOME/Dropbox"
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}

View File

@ -1,15 +0,0 @@
<#
.SYNOPSIS
Opens Microsoft's OneDrive
.DESCRIPTION
This script launches Microsoft OneDrive with the user's OneDrive folder.
.EXAMPLE
PS> ./open-one-drive
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
Start-Process "$($env:USERPROFILE)\AppData\Local\Microsoft\OneDrive\OneDrive.exe"
exit 0 # success