OneMore CLI
Thursday, May 28, 2026
7:57 AM
The OneMore CLI (OneMoreCli.exe) is a companion tool that exposes a selection of OneMore commands as a scriptable command-line executable. It is capable of running either alongside OneNote or even when OneNote is not running at all, presuming OneNote is installed and you have notebooks you can access.
It can run interactively, prompting you for input. Or it can run with a full set of command line arguments making it suitable for use from PowerShell, batch files, or any other shell script.
How to Define an Alias
OneMoreCli.exe is distributed as part of the OneMore installation as of OneMore 7.1.0. While you can run it directly from the install path, you may want to create a more convenient way of running it from any path. For PowerShell users, you can add this function to your $profile script:
function Start-OneMore
{
[CmdletBinding()]
[Alias("onemore")]
param(
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$Args
)
$exe = "$($env:ProgramFiles)\River Software\OneMore\OneMoreCli.exe"
& $exe @Args
}
Usage Synopsis
Interactive mode:
PS> onemore
Script mode:
PS> onemore --help # list all commands
PS> onemore <command> --help # parameter reference for one command
PS> onemore <command> [--param value ...] # non-interactive
Exit codes:
- 0 = success
- 1 = error
Parameters
The first parameter is usually the command name. This is not case-sensitive.
Additional parameters are specified as either key/value pairs or just a key to enable an option. Keys are specified using the forms --key. Single word values do not need quotes, but values containing spaces or other special characters will need quotes.
Common Parameters
- notebook specifies the name of the notebook
- section specifies the name of the section. This can include section groups as well, delimited by a forward slash, such as
PS> onemore export --notebook Colors --section "hues/Sky Blue"
- page specifies the name of the page. If it includes spaces, it must be in quotes.
The combined path expressed by --notebook and --section, and optionally --page, must be a fully resolved absolute path, not a relative path.
|
═══════════════════════════════════════════════════════════════════════════════════════════════
Commands
AddHashtag
Add hashtags to the tag bank on one or more pages.
PS> onemore addhashtags --notebook <string> [--section <string>] --tags <string>
Where tags is a space-separated list of hashtags to add, e.g., "#work #project"
ApplyStyles
Apply the current style theme to one or more pages.
PS> onemore applystyles --notebook <string> [--section <string>] [--page <string>]
Archive
Archive a notebook or section to a zip file
PS> onemore archive --notebook <string> [--section <string>] --outfile <string>
Where outfile specifies the path, with file name, of the output zip file.
Note that the archive command needs OneNote running, so will start it if it is not yet running.
ClearBackground
Clear background color from text and table cells on a page
PS> onemore clearbackground --notebook <string> [--section <string>] [--page <string>]
ClearLog
Clear the OneMore log file.
PS> onemore clearlog
Diagnostics
Report diagnostic information about OneNote and OneMore.
PS> onemore diagnostics [--windows]
Where --windows returns only structured JSON data describing open OneNote windows.
DisableSpellCheck
Disable spell checking on one or more pages
PS> onemore disablespellcheck --notebook <string> [--section <string>] [--page <string>]
EnableSpellChck
Enable spell checking on one or more pages
PS> onemore enablespellcheck --notebook <string> [--section <string>] [--page <string>]
Export
Export pages to a folder in the specified format.
PS> onemore export --notebook <string> [--section <string>] [--page <string>] --outpath <string> --format <string>
outpath specifies a folder to which the output file is written
format may be specified as one of: HTML, PDF, Word, XML, Markdown, or OneNote
When notebook and section are specified, the specified page or all pages in that section are exported to the output path.
When only notebook is specified, a subfolder is created for each section containing its exported pages.
GetHierarchy
Get the hierarchy of notebooks, sections, and pages as an XML hierarchy fragment. The XML is written to stdout or can be piped to an output file of your choosing, e.g., … | Out-File foo.xml.
PS> onemore gethierarchy [--notebook <string>] [--section <string>]
With no parameters, the XML includes all notebooks with their sections.
With the notebook parameter, the XML includes that notebook with its sections.
With both notebook and section, the XML includes that section with its pages.
|
GetPage
Get the full XML content of the specified page. The XML is written to stdout or can be piped to an output file of your choosing, e.g., … | Out-File foo.xml.
PS> onemore getpage --notebook <string> --section <string> [--page <string>|--current]
Where you must specify either --page with a page name or --current for the currently viewed page.
Goto
Navigate OneNote to a specific page or object.
PS> onemore goto --pageId <string> [--objectId <string>]
GotoCommand is also available through the protocol handler:
onemore://GotoCommand/<pageId>[/objectId]
InsertToc
Insert or update a table of contents in the specified page
PS> onemore inserttoc --notebook <string> --section <string> --page <string> [--refresh]
OpenLog
Open the OneMore log file in the default text editor.
PS> onemore openlog
PutPage
Write page XML from a file to a OneNote page.
PS> onemore putpage --notebook <string> --section <string> [--page <string>] --infile <string> --force
If page is specified then it will attempt to either create a page of that name, or if --force is specified, will overwrite an existing page of that name.
|
Recalculate
Recalculate formula table cells on one or more pages
PS> onemore recalculate --notebook <string> [--section <string>] [--page <string>]
RemoveAuthors
Remove author annotations and editBy attributes from one or more pages
PS> onemore removeauthors --notebook <string> [--section <string>] [--page <string>]
RemoveCitations
Remove auto-generated web clipping citations from one or more pages
PS> onemore removecitations --notebook <string> [--section <string>] [--page <string>]
RemoveEmpty
Collapse consecutive empty lines; optionally remove all empty lines from one or more pages
PS> onemore removeempty --notebook <string> [--section <string>] [--page <string>] [--all <yes/no>]
Where all specifies removal of all empty lines instead of keeping one between paragraphs
RemoveHashtag
Remove hashtags from the tag bank on one or more pages.
PS> onemore removehashtags --notebook <string> [--section <string>] --tags <string>
Where tags is a space-separated list of hashtags to add, e.g., "#work #project"
Blank tag banks are removed
RemoveInk
Remove all ink drawings and annotations from one or more pages
PS> onemore removeink --notebook <string> [--section <string>] [--page <string>]
RemoveTags
Remove all tags from one or more pages, except reminder-linked tags
PS> onemore removetags --notebook <string> [--section <string>] [--page <string>]
RestoreAutosize
Restore auto-sizing behavior of manually resized containers on one or more pages
PS> onemore restoreautosize --notebook <string> [--section <string>] [--page <string>]
Search
Search for pages matching a query across a notebook, section, or page and return results as XML. The XML is written to stdout or can be piped to an output file of your choosing, e.g., … | Out-File foo.xml.
PS> onemore search --notebook <string> [--section <string>] [--page <string>] --query <string>
query specifies the search query as described in Search Commands.
SearchHashtags
Search for hashtags matching a query
PS> onemore searchhashtags [--notebook <string>] [--section <string>] [--page <string>] --query <string> --allTags
query specifies the search query as described in Hashtag Commands.
allTags indicates that, for each page that matches the query, all paragraphs with any tags are reported
ToggleDttm
Show or hide date/time stamps on one or more pages.
PS> onemore toggledttm --notebook <string> [--section <string>] [--page <string>] --visibility show|hide
Where visibility specifes whether to show or hide date/time stamps
Trim
Trim leading or trailing whitespace from page text
PS> onemore trim --notebook <string> [--section <string>] [--page <string>] [--leading <yes/no>]
Where leading specifies whether to trim leading whitespace or trailing whitespace; default trim trailing whitespace.
#omwiki #ombasics
© 2020 Steven M Cohn. All rights reserved.
Please consider a sponsorship or one-time donation to support ongoing development
Created with OneNote.