How To Create a OneNote Page from the Command Line

Sometimes you need to create a page in OneNote and it would be much easier to create it from the command line. A perfect example is from within a batch file or other script. The ability to create OneNote pages from the command line is something that OneNote has never offered before.

Now creating a OneNote page from the command line is simple with OneNoteCLI – The OneNote Command Line Interface. In fact OneNoteCLI can also create sections, delete notes, and append text to existing notes.

This article focuses on simply creating notes. We have other articles that discus creating sections, deleting sections, deleting notes, appending to notes, and importing entire directory trees of text files and images into notebooks.

OneNoteCLI Command Line Options

After unzipping OneNoteCLI to any directory open up a command prompt in the same directory as OneNoteCLI.exe and run it to see a list of options:

In order to create a new note use the createnote verb.

When you run OneNoteCLI with just the verb it prints a list of required parameters.

Notice that the parameters notebook, section, title, and body are required.

  • -n – The notebook to create a new page in (must already exist)
  • -s – The section to create a new page in (will be created if it doesn’t already exist)
  • -t – The title of the new page
  • -b – The body of the new page

If any of the above parameters require a space in them be sure to surround them with a quote, like this:

  • -n “Notebook name”
  • -s “Section name”
  • -t “Page title”
  • -b “This is the body of the note”


Let’s say you wanted a new page called First Note in a section called First Section in the notebook called Test Notebook. The command line to create this note is:

After running this command, here is the note that was created:

OneNote page created using the command line

This note was created using the OneNoteCLI command line interface

If you specify a section that does not exist the OneNoteCLI will automatically create that section for you.

Another example. How about creating a page called Todo in a section called Lists in the notebook called Work:

Possible Problems

The biggest problem that you may encounter is trying to create a note in a section that has been deleted. When you delete a section in OneNote it does not immediately go away. Instead it goes to the Recycle Bin, where it is still accessible.

If you try to access a section that is currently in the Recycle Bin OneNoteCLI will throw an error.

The easiest solution to this problem is to empty the OneNote Recycle Bin.

Empty the OneNote Recycle Bin

If you can note create a note in a recently deleted section you may need to empty the OneNote Recycle Bin.

More OneNoteCLI Info

There’s more info about OneNoteCLI if you are interested, including how to import entire directories of text and images, delete notes, and append text to existing notes.

With OneNoteCLI scripting support for OneNote just got a whole lot easier.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.