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, helmut, xnview

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

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

Post 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!
User avatar
michel038
XnThusiast
Posts: 1291
Joined: Tue Sep 27, 2016 8:18 am
Location: France
Contact:

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

Post 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
User avatar
michel038
XnThusiast
Posts: 1291
Joined: Tue Sep 27, 2016 8:18 am
Location: France
Contact:

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

Post 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)
coupland
Posts: 12
Joined: Mon May 29, 2017 5:38 pm

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

Post 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!
Post Reply