Improved check for $lastExitCode

This commit is contained in:
Markus Fleschutz
2025-02-24 20:42:52 +01:00
parent c6929fc266
commit e36021f3b2
91 changed files with 204 additions and 204 deletions

View File

@ -23,7 +23,7 @@ try {
if ($target -eq "" ) { $target = Read-Host "Enter path to target" }
New-Item -path "$symlink" -itemType Junction -value "$target"
if ($lastExitCode -ne "0") { throw "Command 'New-Item' has failed" }
if ($lastExitCode -ne 0) { throw "Command 'New-Item' has failed" }
"✅ Created new junction '$symlink' linking to: $target"
exit 0 # success