Page 1 of 1

Using Open with... to send an image to a batch file

Posted: Sat Jun 23, 2018 8:07 pm
by coupland
I'm trying to configure a batch file as one of the programs to open an image with, but it's not launching as expected. It appears XnView isn't passing the image name correctly to CMD. My xnview.ini is as follows:

OpenWith=C:/Windows/System32/cmd.exe
OpenWithName=Test
OpenWithParam="/c c:\tools\test.cmd"

In theory this should launch CMD.EXE, call my batch file, and pass it the image name as a parameter. But my batch file currently just reads "ECHO %1 %2 %3" and shows that no parameters are being passed to it.

If I call the following from the command-line it works, so it's not a problem with CMD.EXE, it can only be that XnView isn't passing the image name at the end of the command-line:

cmd /c c:\tools\test.cmd "g:\images\test image.jpg" <-- this works

Any way I can change the syntax in my xnview.ini to make this work? TIA for any suggestions!

Re: Using Open with... to send an image to a batch file

Posted: Sat Jun 23, 2018 9:09 pm
by michel038
Here is an exemple
I created a bat file (test.bat) containing :

Code: Select all

echo Hello
type %1
pause
in Xnviewmp, configure "Open with" only with test.bat (name this function Text-list), without parameters

Then , right click on a text file , select Text-list, will diplay the content of the file

Re: Using Open with... to send an image to a batch file

Posted: Sat Jun 23, 2018 9:17 pm
by michel038
another exemple
if my ".bat" file contains :

Code: Select all

"C:\Program Files (x86)\Photofiltre6\photofiltre.exe" %1
"Open with" ... will open selected picture with Photofiltre (It's a picture editor)

Re: Using Open with... to send an image to a batch file

Posted: Sun Jun 24, 2018 12:14 am
by coupland
Thanks michel038, I did some more digging and this is caused by an issue with the file associations on my PC, it's unrelated to XnView. I'll take my question to a PC forum to make some more progress, I appreciate your willingness to help, cheers!