Starting obsidian from command line with URI "...open?path=..." is not working under Windows

What I’m trying to do

Starting Obsidian in Windows with a path to my vault with the following command line:

C:\> "C:\Program Files\Obsidian\Obsidian.exe" "obsidian://open?path=C:\myVault"

I get an error message Unable to find a vault for the URL obsidian://open?path=C:\myVault

Things I have tried

I tried different ways of defining the path

  • obsidian://open?path=C:\myVault
  • obsidian://open?path=C:/myVault
  • obsidian://open?path=file:///C:\myVault
  • obsidian://open?path=file:///C:/myVault

and all of the above URL-Encoded (RFC 1738) like

  • obsidian://open?path=C%3A%5CmyVault

Nothing worked.

What is the correct syntax for the path in Windows?

To open the vault:

  • obsidian://vault/yourVault

If you were including path because you want to open a specific note, then either of these:

  • obsidian:///absolute/path/to/your note
  • obsidian://open?path=%2Fabsolute%2Fpath%2Fto%2Fyour%20note

Remember to encode the path.

More in the docs: Obsidian URI - Obsidian Help

I could not find the answer in the docs. There are no examples with Windows paths.

Those patterns are for Windows (too). Maybe these can help, each one of them for Windows…

Shorthand link to a vault named “my vault”:

"obsidian://vault/my vault/"

Link to a file named “example note.md” in that vault:

obsidian://open?vault=my%20vault&file=example%20note

Same as above but written as a full path, with the vault in a user folder named “jimmyone”:

obsidian://open/?path=C%3A%5CUsers%5Cjimmyone%5Cmy%20vault%5Cexample%20note.md

:backhand_index_pointing_up: as in C:\Users\jimmyone\my vault\example note.md

Same as above and with the full path but using the shorthand syntax:

"obsidian:///C:\Users\jimmyone\my vault\example note.md"
1 Like

Thank you for pointing out the correct syntax. It works for me too, BUT only if the vault is contained in

  • %APPDATA%\\obsidian\\obsidian.json

If the vault resides on a removable drive, its path will be removed from that file and calling the vault with obsidian://open?path=xxx will not work (hence my experiments were unsuccesful). Once you have opened the vault manually via the “Manage Vaults” dialog you can use the paramter obsidian://open?path=xxx again. But using the “Manage Vaults”-Dialog is actually what I want to avoid…

So is there a way to open a vault via its path, if the vault is not contained in %APPDATA%\\obsidian\\obsidian.json because it resides an a removable drive?

That explains it.

I don’t know how your would do that. I think it would require something external to the URI protocol.

The obsidian:// URI scheme looks up information that your vault has indexed (as you found in appdata). So it only works while Obsidian knows about the vault and while the vault is at the known location.

Here is a relevant feature request you may want to support (by pressing the heart button or commenting to explain your use case):

On Linux and other Unixes it is possible to mount an external drive so that it appears to be part of the local filesystem (taking the place of an existing folder). If something like that is possible on Windows, you might be able to add that as a vault (probably twice, once with and once without the drive mounted, so both folders have an .obsidian folder). If that works it will of course add complexity to your setup, may have unwanted side effects in some situations, and you’d probably want to make sure to close the vault before removing the drive.

2 Likes

CawlinTeffid, that’s a neat idea. Similar is possible on Windows, but I don’t have a guess how smoothly it would go with the config folder.

jimmyone, if the extra vigilance might be worthwhile to you, and if you’re not already familiar, an internet search for Windows “mount point folder path” should turn up the steps.

1 Like

@CawlinTeffid, @dawni

NTFS-Mountpoints or NTFS-Junctions might work…

But I fear that I will pay for the simpler startup of obsidian with more complexity when mounting a drive…

Nevertheless I will give it a try.

And I will support the feature request, too.