mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-29 03:13:55 +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
|
.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])"
|
||||||
|
@ -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"
|
||||||
|
Loading…
Reference in New Issue
Block a user