Powershell “Set-PSDebug -Trace 2” causes unexpected results
问题 I'm having a weird problem where I get different behavior when setting "Set-PSDebug -Trace 2". I traced it down to a switch statement not executing properly and was able to reproduce it on Powershell V3 but not on Powershell V2 or Powershell V1 (works as expected) Take the following simple function: function DoTest { $result = "Switch Case Not Executed" $VendorName = "Microsoft" switch ($VendorName) { "Microsoft" { $result = "Switch Case Executed" } } Write-host "Switch: $($VendorName) ->