Force XnViewMP to follow the file order of command-line arguments?

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

Moderator: xnview

PYCHBI
Posts: 1
Joined: Wed Dec 24, 2025 1:03 pm

Force XnViewMP to follow the file order of command-line arguments?

Post by PYCHBI »

Hi everyone,

I’m looking for a way to open multiple images in XnView MP via the command line while preserving the specific order of the arguments.

By default, XnView MP seems to re-sort the files based on its internal settings (e.g., by Name). For example, if I run:
xnviewmp.exe "2.jpg" "1.jpg"

The software automatically re-sorts them, showing 1.jpg before 2.jpg because of the "Name" sort rule. But I want the "Next/Previous" navigation to strictly follow my input order (2.jpg, then 1.jpg).

Is there a specific parameter to disable auto-sorting, or a way to pass a temporary list to the viewer that overrides the folder's default sorting?

-----

Additionally, I noticed a difference in how XnViewMP handles input methods:
  • Direct Path As Arguments:
When I pass file paths directly after the executable (e.g., xnviewmp.exe <1.jpg> <2.jpg>), the program opens directly in Viewer mode as expected.
  • Filelist Parameter:
However, when I use the -filelist parameter with a .txt file (where each line is a path), (e.g., xnviewmp.exe -filelist <filename.txt> ) XnView MP opens in Browser mode,displaying the whole folder, instead of the Viewer.

---

So that, Is there a specific flag I should use with -filelist to force it to open the image in Viewer mode while maintaining the custom list order? Or is this the intended behavior for the filelist parameter?