Smarter command line interpretation
Posted: 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.
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.