Notepad2 Screenshot
, ,

Notepad2 – Commandline Switches

If you don’t know what Notepad2 is, I recommend you check it out if you occasionally prefer a really simple text editor over a heavyweight IDE.

Related Reading: Check out Notepad3

I’d spent some time trying to find this information for advanced options using the Windows command line switches to control how Notepad2 handles the file passed to it. I hope you find it useful.

Notepad2-mod command line options are useful If you setup software to automatically launch Notepad2 (e.g. double-click a filename from grepWin search results),. Leverage these Command line switches to expedite your editing process. For example, use the following to open Notepad2 at the line where a text string was found perhaps using GREPWin (or a different tool like that. You get the idea…):

Notepad2 Command Line Options

C:PortableNotepad2Notepad2.exe /g %line% %path%
Notepad2.exe [encoding] [line-ending-mode] [/e id] [/g ln[,col]]
               [/m[-][r|b] text] [/l|/l0] [/q] [/s ext] [/d] [/h] [/x]
               [/c] [/b] [/n|/ns] [/r|/rs]
               [/p x,y,cx,cy[,max]|/p0|/ps|/p[f|l|t|r|b|m]]
               [/t title] [/i] [/o|/o0] [/f ini|/f0] [/u] [/z ...] [/?]
               [+|-] [file] ...
    file  File to open, can be a relative pathname, or a shell link.
          Must be the last argument, no quoted spaces by default.
    +     Accept multiple file arguments (with quoted spaces).
    -     Accept single file argument (without quoted spaces).
    ...   Desired file encoding (can be one of /ansi, /unicode,
          /unicodebe, /utf8 or /utf8sig).
    ...   Desired line ending mode (either /crlf, /lf, or /cr).
    /e    Specify file source encoding.
    /g    Jump to specified position, /g -1 means end of file.
    /m    Match specified text (/m- last, /mr regex, /mb backslash).
    /l    Auto-reload modified files; /l0 disable change notification.
    /q    Force creation of new files without prompt.
    /s    Select syntax scheme associated with specified extension.
    /d    Select default text scheme.
    /h    Select Web Source Code scheme.
    /x    Select XML Document scheme.
    /c    Open a new Notepad2 window and paste the clipboard contents.
    /b    Open a new Notepad2 paste board to collect clipboard entries.
    /n    Always open a new Notepad2 window (/ns single file instance).
    /r    Reuse Notepad2 window (/rs single file instance).
    /p    Set window position to x,y with size cx,cy, optional max set
          to nonzero to zoom; /p0 system, /ps internal defaults;
    /t    Set window title.
    /i    Start as tray icon.
    /o    Keep window on top; /o0 do not keep window on top.
    /f    Specify ini-file; /f0 use no ini-file (don't save settings).
    /u    Launch with elevated privileges.
    /z    Skip next (usable for registry-based Notepad replacement).
    /?    Display a brief summary about command line parameters.

The complete documentation is available on the original developer‘s website. Enjoy! I suppose you could just run %COMSPEC% in the Notepad2 folder and enter “notepad2.exe /?” That’s just a guess. Not all apps do.

Leave a Reply

Your email address will not be published. Required fields are marked *