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

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, xnview

Post Reply
coupland
Posts: 10
Joined: Mon May 29, 2017 5:38 pm

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

Post by coupland » Sat Jun 23, 2018 8:07 pm

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!

michel038
Posts: 177
Joined: Tue Sep 27, 2016 8:18 am
Location: France

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

Post by michel038 » Sat Jun 23, 2018 9:09 pm

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

michel038
Posts: 177
Joined: Tue Sep 27, 2016 8:18 am
Location: France

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

Post by michel038 » Sat Jun 23, 2018 9:17 pm

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)

coupland
Posts: 10
Joined: Mon May 29, 2017 5:38 pm

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

Post by coupland » Sun Jun 24, 2018 12:14 am

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!

Post Reply