Hi,
I have this simple script:
$files = dir .\configs | ? { !$_.PSIsContainer }
foreach($file in $files)
{
try
{
.\MyApp.exe -ErrorAction Stop $file
}
catch
{
write-host "!!!!!!!!!!!!error!!!!!!!!!!!!!!"
continue
}
}
The problem is that when
.\MyApp.exe -ErrorAction Stop $file
crash, the windows message box about application crash appear and my script block, catch is not hit and only way to continue is click Storno button in the message box.
So how to prevent blocking?