考虑这个简单的代码:错误行为不停止脚本
Read-Host $path
try {
Get-ChildItem $Path -ErrorAction Continue
}
Catch {
Write-Error "Path does not exist: $path" -ErrorAction Stop
Throw
}
Write-Output "Testing"
为什么是“测试”如果指定了无效的路径将被打印到的壳呢?
脚本不停止在catch块中。我究竟做错了什么?