Smarter command line interpretation

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, xnview

Post Reply
User avatar
helmut
Posts: 8172
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Smarter command line interpretation

Post by helmut » Mon Sep 12, 2005 6:53 pm

There are various users that associate their image files with XnView using the Windows dialog "Open with...". When doing so, they will encounter problems and an error message "Error opening file <path name>".

See topics
- Can't open file when path contains space character
- Error opening graphic files in Explorer

The problems are the spaces in the file name (including path). As soon as there are spaces XnView interprets these as a separate parameter.

The following command line options (passed by Windows when double clicking on a file)
C:\My Test Folder\image1.jpg
will be interpreted by XnView as three graphic files:
- C:\My
- Test
- Folder\image1.jpg
and result in the error message "Error opening file C:\My".

The right way to associate graphic files with XnView is using the options ("Tools" > "Options", category "Associations"), but many users don't know this. XnView will set the associations so that quotes are used, e.g. C:\Program Files\XnView\xnview.exe "%1" (please note the double quotes).

I don't know how other programs handle the space problem and I have just made a test on Windows XP SP2 and found that the problem no longer persists. The older Windows versions will persist for a while, so I still wonder whether XnView's interpretation of the command line couldn't be made smarter so that it recognizes even a command line with spaces in the filename/path without double quoting the file names.

User avatar
xnview
Author of XnView
Posts: 31869
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Smarter command line interpretation

Post by xnview » Tue Sep 13, 2005 8:13 am

helmut wrote:I don't know how other programs handle the space problem and I have just made a test on Windows XP SP2 and found that the problem no longer persists. The older Windows versions will persist for a while, so I still wonder whether XnView's interpretation of the command line couldn't be made smarter so that it recognizes even a command line with spaces in the filename/path without double quoting the file names.
The problem is like that:
xnview file1.jpg file2.jpg => 2 parameters received
xnview file with space.jpg => 3 parameters received
So for the second, " is needed.
Pierre.

User avatar
helmut
Posts: 8172
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Smarter command line interpretation

Post by helmut » Tue Sep 13, 2005 5:29 pm

xnview wrote:
helmut wrote:I don't know how other programs handle the space problem and I have just made a test on Windows XP SP2 and found that the problem no longer persists. The older Windows versions will persist for a while, so I still wonder whether XnView's interpretation of the command line couldn't be made smarter so that it recognizes even a command line with spaces in the filename/path without double quoting the file names.
The problem is like that:
xnview file1.jpg file2.jpg => 2 parameters received
xnview file with space.jpg => 3 parameters received
So for the second, " is needed.
Pierre, I know what the problem is (see my post above). I just wonder whether the code interpreting the command line could be smarter.

Post Reply