mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-10 21:33:47 +02:00
Add open-one-drive-folder.ps1
This commit is contained in:
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
|
||||
}
|
Reference in New Issue
Block a user