notepad command line arguments


I was looking for Notepad’s arguments for a sample I’m thinking of writing; I’ve searched the net and found some of these, and had to investigate a bit to find out about the others. I’m a bit surprised it only supports so few flags, I was expecting at least a “go to line” capability. Anyway, here they are:
/A      Ansi: notepad /a file.txt Opens the specified file as Ansi (overrides encoding auto-detection)
/W      Widenotepad /w file.txt Opens the specified file as Unicode (overrides encoding auto-detection)
/P      Printnotepad /p file.txt Opens the file, prints its content to the default printer and exit
/PT     PrintTonotepad /pt “file.txt” “<printername>” prints the file to the specified printer. Both the filename and the printer name have to be in quotes, regardless of the names containing spaces or not. E.g.: notepad /pt “file.txt” “Send To OneNote 2013” or notepad /pt “file.txt” “\\Server\SharedPrinter
/.SETUP SetupMode: E.g. notepad /.setup file.txt.  I’m unclear what this is used for. It’s a weird mode, it does not repaint the window if it was started restored. You’d have to press Alt-Space and Maximize it to view the file content. The window has 2 sets of scrollbars in that case (one set is apparently unused), and it closes if Escape or Ctrl+D are pressed. Perhaps some setup programs invoke notepad with these arguments to display the EULA? Who knows.

/S suppresses the file-not-found prompt (you still get another prompt).
You can also use CMD.exe to control window size (and pipe input):
cmd.exe /c start /max notepad.exe c:/temp/toto.txt

Post a Comment

Your feedback is welcome. Be it positive or negative. Please do not post any irrelevant comment or abuse anyway.

Previous Post Next Post