Improve warning of the cd-* scripts

This commit is contained in:
Markus Fleschutz 2021-05-02 11:51:41 +02:00
parent 042f45439d
commit 2f53d5c1d6
17 changed files with 20 additions and 16 deletions

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/Desktop"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/Documents"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/Downloads"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/Dropbox"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/Music"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/OneDrive"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/Pictures"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -12,6 +12,10 @@ function Get-CurrentUserSID { [CmdletBinding()] param()
$TargetDir = 'C:\$Recycle.Bin\' + "$(Get-CurrentUserSID)"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"
"📂$TargetDir"
exit 0

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/Repos"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -11,7 +11,7 @@ if ($IsLinux) {
$TargetDir = resolve-path "C:/"
}
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$PSScriptRoot"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path ".."
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "../.."
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "../../.."
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "../../../.."
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"

View File

@ -7,7 +7,7 @@
$TargetDir = resolve-path "$HOME/Videos"
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, directory 📂$TargetDir is missing"
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
exit 1
}
set-location "$TargetDir"