tags:

views:

650

answers:

2

I have a script that runs an external exe. When that exe fail (sets errorlevel to 1), the powershell script fails.

I'm running curl.exe and getting this: + CategoryInfo : NotSpecified: ( % Total % ... Time Current:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError

How can I ignore/catch the failure of the external exe and continue with my script?

A: 

I was running the script through powershell_ise (an IDE), I believe this is what caused the problems. Running it through Powershell itself seems to work.

ripper234
+4  A: 

This doesn't have any thing to do with the exit code returned by the EXE. An error is generated when an EXE writes to stderr but only within the ISE or when remoting or using background jobs. An exe that writes to stderr does not generate errors from the regular PowerShell command prompt. I'm not sure why this is the case but if I can get some more info on this I'll update this post.

Keith Hill
JasonMArcher