diff --git a/ConvertOneNote2MarkDown-v2.ps1 b/ConvertOneNote2MarkDown-v2.ps1 index acd154e..3a14577 100644 --- a/ConvertOneNote2MarkDown-v2.ps1 +++ b/ConvertOneNote2MarkDown-v2.ps1 @@ -24,8 +24,8 @@ Function Validate-Dependencies { } # Validate dependencies - if (! (Get-Command -Name 'pandoc.exe') ) { - throw "Could not locate pandoc.exe. Please ensure pandoc is installed." + if (! (Get-Command -Name 'pandoc.exe' -ErrorAction SilentlyContinue) ) { + throw "Could not locate pandoc.exe. Please ensure pandoc is installed for all users, and available in PATH. If pandoc was just installed using .msi or chocolatey, you may need to restart Powershell or the computer for pandoc to be set correctly in PATH." } } diff --git a/README.md b/README.md index b776484..e1b3285 100644 --- a/README.md +++ b/README.md @@ -60,9 +60,7 @@ The powershell script `ConvertOneNote2MarkDown-v2.ps1` will utilize the OneNote * Microsoft Word >= 2016 (To be clear, this is the Desktop version NOT the Windows Store version. Can be installed with [Office 365 Trial](https://www.microsoft.com/en-us/microsoft-365/try) -* [PanDoc >= 2.11.2](https://pandoc.org/installing.html) - - * Note: You may also use [Chocolatey](https://docs.chocolatey.org/en-us/choco/setup#install-with-powershell.exe) to install the [Pandoc package](https://chocolatey.org/packages/pandoc) on Windows, which will set the right path (environment) statements. +* [Pandoc >= 2.11.2](#q-how-to-install-pandoc) ## Usage @@ -165,6 +163,15 @@ To uninstall after your are done converting, simply delete the `C:\PowerShell-7. A: Powershell `7.1.x` and above no longer supports loading Win32 GAC Assemblies, which is needed for interacting with the OneNote Desktop APIs. It is very unlikely that Microsoft will add support for later Powershell Core versions, since Win32 is starting to become deprecated. +### Q: How to install Pandoc? + +A: Pandoc can be installed in any of the following ways: + +* Download [pandoc Windows `.msi` installer](https://pandoc.org/installing.html). During installation, ensure **Pandoc is installed for all users** (by checking the box `Install for all users of thie machine`), which is needed for Pandoc to be available to Administrator. +* Use [Chocolatey](https://docs.chocolatey.org/en-us/choco/setup#install-with-powershell.exe) to install the [Pandoc package](https://chocolatey.org/packages/pandoc) on Windows. + +After installing, ensure to **restart Powershell or the computer** for Pandoc to be set correctly in `PATH`. + ### Q: Error(s) when opening OneNote as Administrator A: If there are errors opening OneNote as Administrator, just open it normally without Administrator permissions. A user has reported successful conversion with only Powershell opened as Administrator. See [case](https://github.com/theohbrothers/ConvertOneNote2MarkDown/issues/149#issuecomment-1418051753).