Actions

Command Line Operations

From XnView Wiki

You may set up a custom shortcut to launch XnView, or use "Run...", for the purpose of executing XnView functions without (or in addition to) launching its normal user interface. In this case, various switches may be used on the command line. The syntax for these commands is the program name, followed by a space and then a hyphen, followed by one or more switches, and each switch must have its specification, if applicable. For example, here is a command-line command showing proper syntax:

<path>xnview.exe -capture=desktop,c:\file.ext


Two Important Points

  • There is a space after "xnview.exe" and before the switch
  • "<path>" means that the full path/filespec must be included in the command. Normally this will be "c:\program files\xnview" and the full command would therefore be "c:\program files\xnview\xnview.exe". However, since the location of xnview.exe is under user control via the installation program, other paths are possible.



Capture

Here are some sample capture commands:

<path>xnview.exe -capture=window
<path>xnview.exe -capture=desktop

<path>xnview.exe -capture=window:\file.ext
<path>xnview.exe -capture=desktop,c:\file.ext

<path>xnview.exe -capture=window,c:\file#.ext
<path>xnview.exe -capture=desktop,c:\file_###.ext

<path>xnview.exe -capture=window,d:\screenshot$.ext
<path>xnview.exe -capture=desktop,d:\screenshot_$.ext

where # is a number (# = 1 or 2 or 3, etc., and ### = 832 or 741, etc.) and $ is a date and time such as 08132007_214818

Extension is taken from the Capture setup dialog. Path and file name is customizable. Screenshot is created, saved and then XnView exits, when using path and file name.

You can create a desktop icon with those parameters and assign a shortcut key / hotkey, then it's possible to make screenshot(s) with a single key.

Thanks to "Dreamer" for contributing and reviewing the information on shortcut keys; September 2007.