Documentation

Command line

This page covers two things: the command line under the panels, where you type commands as in Total Commander, and the parameters that mo-explorer.exe accepts when it is started from a shortcut, a script or another program.

The command line under the panels

A row under the panels runs commands in the folder of the active panel. On the left is the prompt with the current folder, on the right a chip that switches the shell: cmd, Windows PowerShell or PowerShell 7 (offered when pwsh.exe is in PATH).

It is on by default. Show or hide it in the main menu, the command palette or Settings > Command line, where you also choose the shell and the command output.

The command line under the panels with the command git log --oneline -5 typed in, the prompt with the current folder and the shell chip

Keys

KeyAction
Ctrl+Shift+`focus the command line; from the line back to the list
Enterrun the command
Shift+Enterrun it in a new terminal window that stays open
Escclear the line; a second Esc returns to the list
Ctrl+Enterinsert the name of the item under the cursor (in quotes when it has spaces)
Ctrl+Shift+Enterinsert the full path of the item
Up / Down, Ctrl+P / Ctrl+Nbrowse the command history

Ctrl+Enter and Ctrl+Shift+Enter work in the file list too, as long as the command line is shown. With the Total Commander key profile, typing in the list goes straight to the command line. All keys can be remapped in Settings > Shortcuts.

Some commands are handled by the explorer itself and navigate the active panel:

cd D:\Photos      go to a folder (relative paths, %VAR%, shell: and UNC too)
cd ..             one folder up
cd \              drive root
cd -              back to the previous folder
D:                switch drive
C:\Projects\      any path ending with a backslash
cd                show the current folder in a notification

This also works in remote and virtual folders (SFTP, phones, archives). Real shell commands do not run there.

Tokens and variables

The same tokens as in user commands are expanded before running: {file}, {files}, {name}, {dir}, {dest} (the folder of the other pane) and {filelist}. Without tokens the line runs exactly as typed.

notepad {file}
git log --oneline -- {file}

The command gets MO_DIR, MO_DEST, MO_WINDOW and MO_CLI, so mo --cmd ... typed into the line controls this very window (see Automation and scripting).

Command output

  • Terminal window (default, like Total Commander): Enter opens a console with the command that stays open after it ends. Nothing is captured, interactive programs work.
  • Capture output: the command runs hidden. A short output that finishes quickly comes as a notification; a longer one, or an error, opens the output window. A running command appears in the jobs panel, where its cross cancels it. After it ends the folder is refreshed.

Shift+Enter always opens a terminal - handy for long or interactive commands in Capture mode.

History

The last 200 commands are kept in %APPDATA%\MagnumOpus\cmdline_history.txt, without duplicates (a repeated command moves to the top). A command starting with a space is not saved, like in bash. The text you were typing before browsing the history comes back when you press Down past the end.

From scripts

Script IDs: view.command-line (show / hide), app.command-line (focus) and cmdline.run=<text> (run a text as if it were typed):

mo --cmd "cmdline.run=dir /s"

Starting mo-explorer.exe with parameters

mo-explorer.exe [path ...] [switches]
  • Each folder opens in a tab, the first one is active. A file opens its folder with the file selected.
  • Relative paths are resolved against the folder the command was started from, C: is the drive root. sftp://, ftp:// and mtp:// paths work too.
  • If MagnumOpus is already running, everything opens in it. To get a new window every time, turn off Settings > General > Folders from other apps as a tab, or use --new-window.
SwitchMeaning
--select <file>select a file (repeatable)
--new-tabalways a new tab, even when the folder is already open
--new-windowa new window
--split <folder>a second pane on the right
--view <view>list, tiles, grid, detail, columns
--sort <key>[:desc]name, size, date, type, ext
--filter <expr>list filter, text or a query like [ext = pdf] [size > 10mb]
--search <text>name search in the folder including subfolders

--view and --sort apply only to the opened tab - nothing is saved to settings, templates or locked folders. The switches for scripts (--cmd, --results, --list-commands...) are described in Automation and scripting; the complete --help text is in the command-line options reference. --help and --version print to the console the app was started from.

Subcommands of mo.exe

The console launcher mo.exe also runs tasks without a window - for scripts, scheduled tasks and agents:

mo diskmap <folder>        what takes up space (--depth, --top, --min-size, --flat, --json)
mo cleanup [<drive>]       what can be freed on a drive (--list, --run, --yes, --json)
mo link upload <link>      upload the changes of a linked folder (--plan, --yes, --json)
mo diff --sync <profile>   run a synchronization profile (--plan, --run --yes)

Each takes --help; switches, JSON and exit codes are in Automation and scripting, Linking a folder to a server and Comparing and synchronizing folders. Nothing is deleted without --run or --yes.

Examples

mo-explorer.exe D:\Photos --view grid --sort date:desc
mo-explorer.exe C:\Projects --split D:\Backups
mo-explorer.exe --select "D:\Downloads\setup.exe"
mo-explorer.exe . --filter "[ext = pdf] [size > 10mb]"
mo-explorer.exe C:\Projects --search Cargo.toml --new-tab
mo-explorer.exe sftp://my-server/var/log --view columns

A quote inside a --filter or --search value is written as \". A path in quotes may end with a backslash ("%~dp0").

Existing shortcuts

Shortcuts and scripts written for other file managers only need to point to mo-explorer.exe:

  • Explorer: /select,<file>, /e,<folder>, /root,<folder>.
  • Total Commander: /L=<folder> left pane, /R=<folder> right pane, /T new tab, /O into the running window, /N new window.
mo-explorer.exe /L=C:\ /R=D:\ /O

Default folder browser

mo-explorer.exe --default-fm register|unregister [--all-users]

Makes MagnumOpus open folders instead of Explorer (double-click on a folder, Win+E, other apps) - the same as Settings > Windows integration > Default folder browser. With --all-users for all users (run as administrator).

Something wrong or missing? Open an issue