For those of you on Windows that are using this functionality often, you might find Path Copy Copy a useful tool.
It allows you to add custom ways to copy paths in Explorer’s contextual (right-click) menu.
Under Settings > Options, I’ve enabled “Encode whitespace using percent-encoding (e.g., %20)” - which automatically replaces any spaces by “%20” and then enabled “Copy Internet Path” under Settings > Command so that it appears in the main contextual menu.
Now when you right-click any file in Explorer, you can simply click “Copy Internet Path” and it will add the file URL to your clipboard, prefixed by “file:///” as well as replacing any spaces.
Update: Pairing this with an espanso match, this can really speed up your workflow. The below example allows you grab the above link from your clipboard and properly format it as an actual link in Obsidian by simply typing “:file”.
# File link for Obsidian
- trigger: ":file"
replace: "[File]({{clipboard}})"
vars:
- name: "clipboard"
type: "clipboard"