Opening an Obsidian note from a batch file?

Hi there,

I’m coding a simple batch file to have a quick launcher for different things.
I’m trying to open a note within Obsidian by going from the batch file to press a button that will open the note in Obsidian.

Can someone help with this please?
Many thanks

When you say “batch file”, do you mean a Windows .bat file?

If so, very easy, just launch the Obsidian URI:

start obsidian://open?file=my%20note

Obsidian URI format here: https://help.obsidian.md/Concepts/Obsidian+URI

But whatever operating system you’re using (Mac/Linux/whatever), you can launch an Obsidian URI similarly.

1 Like

Hi @AlanG

This is opening the Obsidian program although not the note.

It’s also giving the following error in the batch window
‘file’ is not recognized as an internal or external command, operable program, or batch file.

Thanks for your help AlanG let me know if you know a fix for this. Yes a .bat file :slight_smile:

What version of Windows are you on? The above works for me on Win 10 from a batch file.

You ARE changing it to point at an actual note, right?

1 Like

Thanks for your quick replies.
I am on Windows 11 and I will give a full example here.

cls
start obsidian://open?vault=vaultname&file=example_note
pause

It’s opening the Obsidian app I’m guessing with
start obsidian://open?vault=vaultname

although after it gives the error
‘file’ is not recognized as an internal or external command, operable program, or batch file.

Yes I have the actual code pointing towards a current vault and note.

Appreciate your help my friend.
@AlanG

The & is a character which the CLI wants to use. Since you don’t need the name of the vault just take it out and use only the file param:

cls
start obsidian://open?file=example_note
pause
1 Like

start obsidian://open?file=obsidian%2Fcharity

This has helped with that CLI error although won’t link through my folder named “obsidian” to the file “charity”.

It’s opening Obsidian and showing the error in the top right File “ObsidianFcharity” not found.

I’m guessing this is because of the %2F in the Obsidian url. How can I link through to this note in the folder location? @AlanG

Fixed.

Just delete the %2F altogether and replace it with the / as directory.
start obsidian://open?file=obsidian/charity for example.

Thanks to @AlanG <3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.