PDA

View Full Version : How to capture error messages from command line



sockduct
31.01.2018, 10:05 AM
Hello,

When starting irfanview from the command line, how do you capture error messages? For example, let's say I try to open a BMP image file:
i_view32.exe images\swirl.bmp

Attempting to load this image results in the following pop up error from irfanview:
"swirl.bmp: Decode error! Invalid or unsupported BMP file."

However, irfanview keeps running (no exit error code) and I don't see any error indications from the command line. Is there a way to capture this error from the command line or programmatically via an API?

Please advise,
--Jim

Kuki Dent
31.01.2018, 10:57 AM
From i_options.txt: "IrfanView exit code is 0. If /convert or /print is used, there is 1 or 2 also possible, for load/save error."
No other exit codes (error codes) are documented.

sockduct
31.01.2018, 11:43 AM
Thank you for the reply. However, that still does not answer my question - when loading an image from the command line where irfanview encounters an error loading the image, is it possible to capture the error message from the command line or via an API?

Kuki Dent
31.01.2018, 04:09 PM
If you use Windows command window, you have two options to capture what you see in that window:
1) you can make a screenshot (this is a Windows feature, please ask if you don't know how) or use Irfanview for a screenshot.
2) you can mark the text with the mouse, copy the marked text with [CTRL]+[C], and paste the text to an editor or office application to
save it there.

Hope this is the help you're looking for.

sockduct
31.01.2018, 05:30 PM
Hello Kuki,

Thank you again for the reply. I was hoping for a programmatic solution. Let's say I'm trying to load 1 million images. It would be nice to know which ones failed to load because of some kind of error (for example, an invalid image file). While taking a print screen or manually copying the error text certainly works for hand viewing a few images, I'm sure you'd agree that this would be undesirable to do for viewing a million different image files.

Also, please let me know if this is the wrong forum to ask this kind of question. Is there one that's better suited for programmatic type questions?

Best regards,
--Jim

Kuki Dent
31.01.2018, 09:37 PM
Hi Jim,
I've never used Irfanview command line options. But I've I taught myself how to use MS-DOS. So I know some tricks.
Don't know is this works with Irfanview, but you can try to add "> faults.txt" (without "") to paste all Irfanview output to a text file.
You won't see any output in the command window then. Irfanview is ready when you see the prompt appears again.