mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-10 18:44:50 +02: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
|
Computer, open `name` folder
|
||||||
--------------------------
|
--------------------------
|
||||||
* launches the File Explorer with the given 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.
|
* 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
|
.SYNOPSIS
|
||||||
Opens the user's Dropbox folder
|
Opens the Dropbox folder
|
||||||
.DESCRIPTION
|
.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
|
.EXAMPLE
|
||||||
PS> ./open-dropbox-folder
|
PS> ./open-dropbox-folder
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -12,12 +12,12 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$TargetDir = resolve-path "$HOME/Dropbox"
|
$TargetDirs = resolve-path "$HOME/Dropbox*"
|
||||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
foreach($TargetDir in $TargetDirs) {
|
||||||
throw "Dropbox folder at 📂$TargetDir doesn't exist (yet)"
|
|
||||||
}
|
|
||||||
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
|
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
}
|
||||||
|
throw "No Dropbox folder at 📂$HOME/Dropbox"
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
exit 1
|
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