Update cd-crashdumps.ps1 and list-special-folders.ps1

This commit is contained in:
Markus Fleschutz 2023-10-16 08:41:58 +02:00
parent 69ccb6a2af
commit 8b6e9f6b98
2 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,7 @@
.SYNOPSIS .SYNOPSIS
Change to the crash dumps folder Change to the crash dumps folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the crash dumps directory (Windows only). This PowerShell script changes the working directory to the crash dumps directory (Windows only). Whenever a software crashes and crash dumps are enabled(!) a crash dump file is written. This file helps to identify the reason for the crash.
.EXAMPLE .EXAMPLE
PS> ./cd-crashdumps PS> ./cd-crashdumps
📂C:\Users\Markus\AppData\Local\CrashDumps 📂C:\Users\Markus\AppData\Local\CrashDumps
@ -13,12 +13,15 @@
#> #>
try { try {
[string]$Path = Resolve-Path -Path "~" if ($IsLinux) { throw "Sorry, Windows only" }
if (!(Test-Path $Path)) { throw "Home directory at $Path doesn't exist (yet)" }
$Path += "\AppData\Local\CrashDumps" [string]$path = Resolve-Path -Path "~"
if (!(Test-Path $Path)) { throw "Crashdumps directory at $Path doesn't exist (yet)" } if (!(Test-Path "$path" -pathType container)) { throw "Home directory at $path doesn't exist (yet)" }
$path += "\AppData\Local\CrashDumps"
if (!(Test-Path "$path" -pathType container)) { throw "Crashdumps directory at $path doesn't exist (yet)" }
Set-Location "$Path" Set-Location "$Path"
"📂$Path" "📂$path"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -67,6 +67,7 @@ function ListSpecialFolders {
TryFolder "$_" "$path" TryFolder "$_" "$path"
} }
} }
TryFolder "CrashDumps" "$HOME\AppData\Local\CrashDumps"
TryFolder "Repositories" "$HOME\source\repos" TryFolder "Repositories" "$HOME\source\repos"
TryFolder "Scripts" "$PSScriptRoot" TryFolder "Scripts" "$PSScriptRoot"
TryFolder "SSH keys" "$HOME\.ssh" TryFolder "SSH keys" "$HOME\.ssh"