mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-17 02:01:01 +01:00
Add open-one-drive-folder.ps1
This commit is contained in:
parent
c5a3bf0608
commit
710ff06e9d
@ -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.
|
||||
|
||||
|
||||
|
@ -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
|
@ -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
|
||||
|
24
Scripts/open-one-drive-folder.ps1
Normal file
24
Scripts/open-one-drive-folder.ps1
Normal 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
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user