mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-22 20:51:17 +01:00
Update cd-trash.ps1 and cd-recycle-bin.ps1
This commit is contained in:
parent
3d64a05c57
commit
60c1004a40
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's recycle bin folder
|
||||
Sets the working directory to the recycle bin folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's recycle bin folder.
|
||||
.EXAMPLE
|
||||
@ -20,13 +20,13 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = "$HOME/.local/share/Trash/"
|
||||
$path = "$HOME/.local/share/Trash/"
|
||||
} else {
|
||||
$Path = "C:\$Recycle.Bin\" + "$(GetCurrentUserSID)"
|
||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Recycle bin folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Recycle bin folder at 📂$path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's trash folder
|
||||
Sets the working directory to the trash folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's trash folder.
|
||||
.EXAMPLE
|
||||
@ -20,13 +20,13 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = "$HOME/.local/share/Trash/"
|
||||
$path = "$HOME/.local/share/Trash/"
|
||||
} else {
|
||||
$Path = "C:\$Recycle.Bin\" + "$(GetCurrentUserSID)"
|
||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Trash folder at 📂$Path doesn't exist (yet)" }
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "Trash folder at 📂$path doesn't exist (yet)" }
|
||||
Set-Location "$path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user