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: 2
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?
User avatar
xnview
Author of XnView
Posts: 47743
Joined: Mon Oct 13, 2003 7:31 am
Location: France

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

Post by xnview »

PYCHBI wrote: Wed Apr 29, 2026 2:06 pm 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?
currently no way
  • 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.
It opens in browser but displays only files from filelist
Pierre.
PYCHBI
Posts: 2
Joined: Wed Dec 24, 2025 1:03 pm

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

Post by PYCHBI »

Thanks for reply.

Could we add these two command-line parameters?
- Sort by input order (the order in which path are passed)
- Open file list (from .txt) in Viewer immediatly instead of Browser

Possible? Thanks!

XnView MP is my favorite image viewer. Better command-line support would make it even more awesome