Help to replace username in external link with shell commands plugin

Hi,

I use a shared vault with my team and I use external links to local files outside my Obsidian vault e.g. pdfs, which are also synced by OneDrive.

When I link to these local and external files, my links look like this:

[Link-name](<file:c:\Users\$My-User-Name$\....pdf>)

where:

  • $My-User-Name$ represents my system user name
  • and “…” represents the remaining file path

What I’m trying to do

The other people of my team should be able to open the links to external files, which are also synced by OneDrive on their laptops. Indeed, my external links link to my local drive c:\ and the file path contains my username, but as the OneDrive-settings on all team laptops are identical, OneDrive syncs to the same path on all laptops.
Therefore I only need to replace my username by an environment variable and tell Obsidian to replace that environment variable by the system username.

Things I have tried

I installed the plugin Shell commands and tried the following:

[Link-name](<file:c:\Users\{{environment:%username%}}\....pdf>)

but that didn’t work.

Is there something else I need to consider? (All Laptops are Windows 365).

Thanks in advance,
kind regards,

Silias