Updated cd-onedrive.ps1

This commit is contained in:
Markus Fleschutz 2025-05-30 10:18:01 +02:00
parent 391c93f9d5
commit 74abe7ce45

View File

@ -1,11 +1,11 @@
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to the user's OneDrive folder Sets the working dir to the OneDrive folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's OneDrive folder. This PowerShell script sets the current working directory to the user's OneDrive folder.
.EXAMPLE .EXAMPLE
PS> ./cd-onedrive PS> ./cd-onedrive.ps1
📂C:\Users\Markus\OneDrive entered (has 2 files and 0 folders) 📂C:\Users\Markus\OneDrive with 2 files and 0 folders entered.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -20,7 +20,7 @@ try {
Set-Location "$path" Set-Location "$path"
$files = Get-ChildItem $path -attributes !Directory $files = Get-ChildItem $path -attributes !Directory
$folders = Get-ChildItem $path -attributes Directory $folders = Get-ChildItem $path -attributes Directory
"📂$path entered (has $($files.Count) files and $($folders.Count) folders)" "📂$path with $($files.Count) files and $($folders.Count) folders entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"