Open several text files at once with Notepad++

I edit several CSS files at once, how can I open them all at the same time?

You can make use of the Notepad++ Session Manager.

To save a session:

  • Start Notepad++

  • Open the files you want to have in the session.

  • "File" > "Save Session..."

  • Give your session a session "Name" and a "Link" (name of the session file), then click "OK"

    enter image description here

  • Close Notepad++

To restore a session:

  • Start Notepad++

  • "File" > "Load Session..."

  • Browse to the the saved session and click "OK"

    enter image description here


Sessions And Projects

How to store and retrieve sets of files as they were opened in Notepad++

Sessions keep track of what files are opened in Notepad++, with some extra information like file positions and highlighter for the file. The detailed contents of session files is described in the relevant section of Editing Configuration Files. Sessions do not backup files - see Settings -> Preferences -> Backup/Auto-Completion about this.

There are exactly 5 controls in Notepad++ that relate to sessions:

  • File -> Load session....
  • File -> Save session....
  • Settings -> Preferences -> Backup -> Remember current session for next launch
  • Settings -> Preferences -> Backup -> Enable session snapshots and periodic backups*
  • Settings -> Preferences -> MISC -> Session file ext.:

...

Session files

They are plain xml files, with some obvious structure you can borrow from existing session. This means you can edit them manually, if this is easier. In particular, session files will record bookmarks and how text is folded.

By default, session files have the .xml extension, but you can change that from Settings -> Preferences -> MISC -> Session file ext (look in the lower right corner).

session.xml does not get renamed when you change the default session extension. This is not an issue, because you can ask Notepad++ to load any file, as long as it has contents that can be understood.

Source Sessions And Projects


Using shell scripts

When you run the command notepad++ <file1> <file2> ... it opens all of those files in notepad++.

Using this feature, you can make a script for each set of files that will open all the files listed.

I'm assuming you're on windows because you're using notepad++ so here's how to do that for windows.

How to make a script

  • Open up your favorite text editor (probably notepad++)
  • Type in the command you want to run (probably notepad++ <file1> <file2> ...
  • Save the file as <name>.bat

Tags:

Notepad++