<?xml version="1.0" encoding="UTF-8"?>
<article id="Command_line">
  <title>Command line<indexterm>
      <primary>command line</primary>
    </indexterm><indexterm>
      <primary>WinMerge command line</primary>

      <see>command line</see>
    </indexterm></title>

  <para>The WinMerge command line accepts several parameters in addition to the
  paths to compare. Most of these parameters are intended for using WinMerge as
  an external compare application or starting a compare operation from a batch
  file.</para>

  <para>Use one of these formats for the WinMerge command:</para>

  <para><cmdsynopsis sepchar=" ">
      <command>WinMergeU</command>

      <arg choice="opt" rep="norepeat"><option>/?</option></arg>
    </cmdsynopsis></para>

  <para><cmdsynopsis sepchar=" ">
      <command>WinMergeU</command>

      <arg choice="opt" rep="norepeat"><option>/r</option></arg>

      <arg choice="opt" rep="norepeat"><option>/e</option></arg>

      <arg choice="opt" rep="norepeat"><option>/f</option>
      <replaceable>filter</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/m</option>
      <replaceable>compare-method</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/t</option>
      <replaceable>window-type</replaceable></arg>

      <arg><option>/x</option></arg>

      <arg><option>/xq</option></arg>

      <arg><option>/s</option></arg>

      <arg><option>/sw</option></arg>

      <arg><option>/s-</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ul</option></arg>

      <arg choice="opt" rep="norepeat"><option>/um</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ur</option></arg>

      <arg choice="opt" rep="norepeat"><option>/u</option></arg>

      <arg choice="opt" rep="norepeat"><option>/wl</option></arg>

      <arg choice="opt" rep="norepeat"><option>/wm</option></arg>

      <arg choice="opt" rep="norepeat"><option>/wr</option></arg>

      <arg choice="opt" rep="norepeat"><option>/new</option></arg>

      <arg choice="opt" rep="norepeat"><option>/self-compare</option></arg>

      <arg choice="opt" rep="norepeat"><option>/clipboard-compare</option></arg>

      <arg><option>/minimize</option></arg>

      <arg><option>/maximize</option></arg>

      <arg choice="opt" rep="norepeat"><option>/fl</option></arg>

      <arg choice="opt" rep="norepeat"><option>/fm</option></arg>

      <arg choice="opt" rep="norepeat"><option>/fr</option></arg>

      <arg choice="opt" rep="norepeat"><option>/l</option>
      <replaceable>linenumber</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/c</option>
      <replaceable>charpos</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/table-delimiter</option>
      <replaceable>delimiter</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/dl</option>
      <replaceable>leftdesc</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/dm</option>
      <replaceable>middledesc</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/dr</option>
      <replaceable>rightdesc</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/al</option></arg>

      <arg choice="opt" rep="norepeat"><option>/am</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ar</option></arg>

      <arg choice="opt" rep="norepeat"><option>/noninteractive</option></arg>

      <arg choice="opt" rep="norepeat"><option>/noprefs</option></arg>

      <arg choice="opt" rep="norepeat"><option>/enableexitcode</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ignorews</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ignoreblanklines</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ignorecase</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ignoreeol</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ignorecodepage</option></arg>

      <arg choice="opt" rep="norepeat"><option>/ignorecomments</option></arg>

      <arg choice="opt" rep="norepeat"><option>/unpacker</option>
      <replaceable>unpacker-name</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/prediffer</option>
      <replaceable>prediffer-name</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/cp</option>
      <replaceable>codepage</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/fileext</option>
      <replaceable>file-extension</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/cfg</option>
      <replaceable>name=value</replaceable></arg>

      <arg choice="opt" rep="norepeat"><option>/inifile</option>
      <replaceable>inifile</replaceable></arg>

      <arg choice="plain"
      rep="norepeat"><replaceable>leftpath</replaceable></arg>

      <arg cchoice="opt"
      rep="norepeat"><replaceable>middlepath</replaceable></arg>

      <arg choice="plain"
      rep="norepeat"><replaceable>rightpath</replaceable></arg>

      <arg choice="opt"
      rep="norepeat"><option>/o</option>
      <replaceable>outputpath</replaceable></arg>

      <arg choice="opt"
      rep="norepeat"><option>/or</option>
      <replaceable>reportpath</replaceable></arg>

    </cmdsynopsis></para>

  <cmdsynopsis sepchar=" ">
    <command>WinMergeU</command>

    <arg choice="plain"
    rep="norepeat"><replaceable>conflictfile</replaceable></arg>
  </cmdsynopsis>

  <para>Entering the command with no parameters or pathnames simply opens the
  WinMerge window. Parameters are prefixed with either a forward slash (
  <literal>/</literal> ) or dash ( <literal>-</literal> ) character. Pathnames
  have no prefix character.</para>

  <variablelist>
    <varlistentry>
      <term><option>/?</option></term>
      <listitem>
        <para>Opens WinMerge Help at this topic.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>recursive folder compare</primary>
      </indexterm>
      <term><option>/r</option></term>
      <listitem>
        <para>Compares all files in all subfolders (recursive
        compare). Unique folders (occurring only on one side) are listed in the
        compare result as separate items. Note that including subfolders can
        increase compare time significantly. Without this parameter, WinMerge
        lists only files and subfolders at the top level of the two target
        folders. It does not compare the subfolders.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>WinMerge window</primary>
        <secondary>closing</secondary>
      </indexterm>

      <term><option>/e</option></term>
      <listitem>
        <para>Enables you to close WinMerge with a single
        <keycap>Esc</keycap> key press. This is useful when you use WinMerge as an
        external compare application: you can close WinMerge quickly, like a
        dialog. Without this parameter, you might have to press
        <keycap>Esc</keycap> multiple times to close all its windows.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>filters</primary>
        <secondary>applying in command line</secondary>
      </indexterm>

      <term><option>/f</option></term>
      <listitem>
        <para>Applies a specified filter to restrict the
        comparison. The filter can be a filemask like <filename><userinput>*.h
        *.cpp</userinput></filename>, or the name of a file filter like
        <userinput>XML/HTML Devel</userinput>. Add quotation marks around a filter
        mask or name that contains spaces.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>compare method</primary>
        <secondary>applying in command line</secondary>
      </indexterm>

      <term><option>/m <replaceable>compare-method</replaceable></option></term>
      <listitem>
        <para>Sets the compare method to use for the comparison.
        This can be one of the keywords <userinput>Full</userinput>,
        <userinput>Quick</userinput>, <userinput>Binary</userinput>,
        <userinput>Date</userinput>, <userinput>SizeDate</userinput> or 
        <userinput>Size</userinput>.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>window type</primary>
        <secondary>applying in command line</secondary>
      </indexterm>

      <term><option>/t <replaceable>window-type</replaceable></option></term>
      <listitem>
        <para>Specifies the type of window in which to display files.
        This can be one of the keywords <userinput>Text</userinput>,
        <userinput>Table</userinput>, <userinput>Binary</userinput>,
        <userinput>Image</userinput> or <userinput>Webpage</userinput>.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/x</option></term>
      <listitem>
        <para>Closes WinMerge (after displaying an information
        dialog) when you start a comparison of identical files. The parameter has
        no effect after the comparison, for example if the files become identical
        as a result of merging or editing. This parameter is useful when you use
        WinMerge as an external compare application, or when you want to eliminate
        unnecessary steps by ignoring files that don't have any
        differences.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/xq</option></term>
      <listitem>
        <para>Is similar to <option>/x</option> but does not
        show the message about identical files.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>WinMerge window</primary>
        <secondary>limiting instances</secondary>
      </indexterm>

      <term><option>/s</option></term>
      <listitem>
        <para>Limits WinMerge windows to a single instance.
        For example, if WinMerge is already running, a new compare opens in the
        same instance. Without this parameter, multiple windows are allowed:
        depending on other settings, a new compare might open in the existing
        window or in a new window.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/sw</option></term>
      <listitem>
        <para>Limit the WinMerge window to one instance as well as the option /s.
         However, it waits for the instance displaying the window to terminate.
        </para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/s-</option></term>
      <listitem>
        <para>Ensure that another instance is always executed, ignoring the
        value of the "Allow only one instance to run" option.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>MRU list</primary>
      </indexterm>

      <term><option>/ul</option></term>
      <listitem>
        <para>Prevents WinMerge from adding the left path to
        the Most Recently Used (MRU) list. External applications should not add
        paths to the MRU list in the Select Files or Folders dialog.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/um</option></term>
      <listitem>
        <para>Prevents WinMerge from adding the middle path to
        the Most Recently Used (MRU) list. External applications should not add
        paths to the MRU list in the Select Files or Folders dialog.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/ur</option></term>
      <listitem>
        <para>Prevents WinMerge from adding the right path to
        the Most Recently Used (MRU) list. External applications should not add
        paths to the MRU list in the Select Files or Folders dialog.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/u</option></term>
      <listitem>
        <para>Prevents WinMerge from adding either path (left
        or right) to the Most Recently Used (MRU) list. External applications
        should not add paths to the MRU list in the Select Files or Folders
        dialog.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>protecting files</primary>
      </indexterm>

      <term><option>/wl</option></term>
      <listitem>
        <para>Opens the left side as read-only. Use this when
        you don't want to change left side items in the compare.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/wm</option></term>
      <listitem>
        <para>Opens the middle side as read-only. Use this
        when you don't want to change right side items in the compare.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/wr</option></term>
      <listitem>
        <para>Opens the right side as read-only. Use this
        when you don't want to change right side items in the compare.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/new</option></term>
      <listitem>
        <para>Opens a new blank window.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/self-compare</option></term>
      <listitem>
        <para>Compares the specified file with a copy of the file.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/clipboard-compare</option></term>
      <listitem>
        <para>Compares the two most recent contents of the clipboard history.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>WinMerge window</primary>
        <secondary>opening minimized or maximized</secondary>
      </indexterm>

      <term><option>/minimize</option></term>
      <listitem>
        <para>Starts WinMerge as a minimized window.
        This option can be useful during lengthy compares.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/maximize</option></term>
      <listitem>
        <para>Starts WinMerge as a maximized
        window.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/fl</option></term>
      <listitem>
        <para>Sets focus to the left side at startup.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/fm</option></term>
      <listitem>
        <para>Sets focus to the middle side at startup.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/fr</option></term>
      <listitem>
        <para>Sets focus to the right side at startup.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/l <replaceable>linenumber</replaceable></option></term>
      <listitem>
        <para>Specifies a line number to jump to after loading the files.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/c <replaceable>charpos</replaceable></option></term>
      <listitem>
        <para>Specifies a character position to jump to after loading the files.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/table-delimiter <replaceable>delimiter</replaceable></option></term>
      <listitem>
        <para>Specifies a delimiter character for table editing. To specify a tab character, specify "tab", "\t", or "\x09".</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/dl</option></term>
      <listitem>
        <para>Specifies a description in the left side title
        bar, overriding the default folder or filename text. For example:
        <userinput>/dl "Version 1.0</userinput>" or <userinput>/dl
        WorkingCopy</userinput>. Use quotation marks around descriptions that
        contain spaces.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/dm</option></term>
      <listitem>
        <para>Specifies a description in the middle side title
        bar, just like <option>/dl</option>.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/dr</option></term>
      <listitem>
        <para>Specifies a description in the right side title
        bar, just like <option>/dl</option>.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/al</option></term>
      <listitem>
        <para>Auto-merges at the left side at startup.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/am</option></term>
      <listitem>
        <para>Auto-merges at the middle side at startup.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/ar</option></term>
      <listitem>
        <para>Auto-merges at the right side at startup.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/noninteractive</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/noprefs</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/enableexitcode</option></term>
      <listitem>
        <para>Sets the comparison result to the process exit code. 0: identical, 1: different, 2: error</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/ignorews</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/ignoreblanklines</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/ignorecase</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/ignoreeol</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/ignorecodepage</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/ignorecomments</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/unpacker</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/prediffer</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/cp</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/fileext <replaceable>file-extension</replaceable></option></term>
      <listitem>
        <para>Specifies a file extension for determining syntax hightliting.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/cfg</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option><replaceable>leftpath</replaceable></option></term>
      <listitem>
        <para>Specifies the folder, file or project file to open on the left side.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option><replaceable>middlepath</replaceable></option></term>
      <listitem>
        <para>Specifies the folder, file or project file to open on the middle side.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option><replaceable>rightpath</replaceable></option></term>
      <listitem>
        <para>Specifies the folder, file or project file to open on the right side.</para>

        <para>WinMerge cannot compare files to folders, so the path parameters
        (<option><replaceable>leftpath</replaceable></option>,
        <option><replaceable>middlepath</replaceable></option> and
        <option><replaceable>rightpath</replaceable></option>) must point to the
        same target type (either folders or files). If WinMerge cannot find either
        of the specified paths, it opens the Select Files or Folders dialog, where
        you can browse for the correct paths.</para>

        <tip>
          <para>In file comparisons, you can specify a folder name in one of the
          path parameters, as long as the folder contains a file with the same
          name as the one specified in the other, file path.</para>

          <para>For example, consider this command:</para>

          <para><userinput>WinMergeU <filename>C:\Folder\File.txt</filename>
          <filename class="directory">C:\Folder2</filename> </userinput></para>

          <para>If <filename class="directory">C:\Folder2</filename> contains a
          file named <filename>File.txt</filename>: WinMerge implicitly resolves
          the second path as a file specification, and compares the two files. Of
          course, the command is invalid if <filename
          class="directory">C:\Folder2</filename> does <emphasis>not</emphasis>
          contain a file named <filename>File.txt</filename>.</para>
        </tip>
        <para></para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>merging differences</primary>
        <secondary>result file</secondary>
      </indexterm>

      <term><option>/o <replaceable>outputpath</replaceable></option></term>
      <listitem>
        <para>Specifies an optional output file path where you want merged result files to be
        saved.</para>

        <para>The output path is rarely needed when you start WinMerge from
        the command line. It is meant to be used with version control tools, where
        you might need to specify a output path for the
        <wordasword>result</wordasword> file. If you specify a output path,
        WinMerge still shows only two or three files in the File Compare window. However,
        if you save either of these files, it is written to the output path,
        leaving the two or three source files intact.</para>

        <para>Version control systems typically refer to the source and result
        files using terms like <glossterm>theirs</glossterm>,
        <glossterm>mine</glossterm>, and either <glossterm>merged</glossterm> or
        <glossterm>resolved</glossterm>. If you specify a output path on the
        WinMerge command line, and are working with a version control system, you
        should list the files in that order.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><option>/or</option></term>
      <listitem>
        <para>TBD</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>conflict files</primary>
        <secondary>specifying on command line</secondary>
      </indexterm>

      <term><option><replaceable>conflictfile</replaceable></option></term>
      <listitem>
        <para>Specifies a conflict file, typically generated by a Version control system. The
        conflict file opens in the File Compare window, where you can merge and
        resolve conflicts, as described in <xref
        linkend="ResolveConflictFiles" />. Note that no other paths can be used
        with a conflict file.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <indexterm>
        <primary>ini file</primary>
        <secondary>specifying on command line</secondary>
      </indexterm>

      <term><option>/inifile <replaceable>inifile</replaceable></option></term>
      <listitem>
        <para>specifies an INI file used to load and save settings instead of the registry.</para>
      </listitem>
    </varlistentry>

  </variablelist>
</article>
