mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 07:53:21 +01:00
Update cd-crashdumps.ps1 and list-special-folders.ps1
This commit is contained in:
parent
69ccb6a2af
commit
8b6e9f6b98
@ -2,7 +2,7 @@
|
||||
.SYNOPSIS
|
||||
Change to the crash dumps folder
|
||||
.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
|
||||
PS> ./cd-crashdumps
|
||||
📂C:\Users\Markus\AppData\Local\CrashDumps
|
||||
@ -13,12 +13,15 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
[string]$Path = Resolve-Path -Path "~"
|
||||
if (!(Test-Path $Path)) { throw "Home directory at $Path doesn't exist (yet)" }
|
||||
$Path += "\AppData\Local\CrashDumps"
|
||||
if (!(Test-Path $Path)) { throw "Crashdumps directory at $Path doesn't exist (yet)" }
|
||||
if ($IsLinux) { throw "Sorry, Windows only" }
|
||||
|
||||
[string]$path = Resolve-Path -Path "~"
|
||||
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"
|
||||
"📂$Path"
|
||||
"📂$path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -67,6 +67,7 @@ function ListSpecialFolders {
|
||||
TryFolder "$_" "$path"
|
||||
}
|
||||
}
|
||||
TryFolder "CrashDumps" "$HOME\AppData\Local\CrashDumps"
|
||||
TryFolder "Repositories" "$HOME\source\repos"
|
||||
TryFolder "Scripts" "$PSScriptRoot"
|
||||
TryFolder "SSH keys" "$HOME\.ssh"
|
||||
|
Loading…
Reference in New Issue
Block a user