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.
Smarter command line interpretation
Moderators: XnTriq, helmut, xnview
-
- Posts: 8705
- Joined: Sun Oct 12, 2003 6:47 pm
- Location: Frankfurt, Germany
-
- Author of XnView
- Posts: 44449
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Smarter command line interpretation
The problem is like that: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.
xnview file1.jpg file2.jpg => 2 parameters received
xnview file with space.jpg => 3 parameters received
So for the second, " is needed.
Pierre.
-
- Posts: 8705
- Joined: Sun Oct 12, 2003 6:47 pm
- Location: Frankfurt, Germany
Re: Smarter command line interpretation
Pierre, I know what the problem is (see my post above). I just wonder whether the code interpreting the command line could be smarter.xnview wrote:The problem is like that: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.
xnview file1.jpg file2.jpg => 2 parameters received
xnview file with space.jpg => 3 parameters received
So for the second, " is needed.