How to Copy Portable Local Links for SharePoint and OneDrive Files
Question details
The user needs a method to generate portable local file paths for synced OneDrive or SharePoint files so colleagues can open them directly without the links defaulting to a web browser.
- Product
- Microsoft OneDrive and SharePoint
- Device & OS
- Windows
- Scenario
- Sharing synced files with colleagues using local network paths instead of standard web-based sharing URLs.
- Observed behavior
- Copied local paths include the specific user's profile folder name (e.g., C:\Users\Username), which breaks the link when a colleague tries to click it on their own machine.
Before attempting to create portable local paths, ensure both you and your colleagues have synced the exact same SharePoint document library or OneDrive shared folder to your local Windows environments.
Manually Replace the Path with an Environment Variable
Since Windows lacks a built-in portable link generator, manually replacing your username with a Windows environment variable allows the link to adapt to any user's profile.
Windows uses environment variables to act as placeholders for system paths. The %USERPROFILE% variable automatically points to the current user's profile folder.
By replacing your specific username in the local path with this variable, the file path becomes universal for anyone who has the same folder structure synced to their default user directory.
Navigate to the file in File Explorer, hold down the Shift key, right-click the file, and select 'Copy as path'.
Paste the copied path into your chat message or email. It will look something like "C:\Users\JohnDoe\OneDrive - Company\Document.docx".
Delete the "C:\Users\JohnDoe" portion and replace it with "%USERPROFILE%". The final portable link should look like "%USERPROFILE%\OneDrive - Company\Document.docx".
Use Native OneDrive/SharePoint Sharing Links
If environment variables are too cumbersome for everyday use, utilize the built-in sharing features to generate accessible links, though they may open in a web browser by default.
Collaborate Seamlessly with WPS Office
Tired of dealing with broken file paths and complicated sync issues in Microsoft Office? WPS Office offers a lightweight, high-performance alternative with built-in cloud sharing that makes collaboration effortless.
- 1. Download and Install: Get the free WPS Office suite from the official website and install it on your device.
- 2. Save to WPS Cloud: Save your documents directly to the integrated WPS Cloud for seamless cross-device synchronization.
- 3. Share universally: Click the Share button to generate a secure, universal link that your colleagues can open effortlessly, bypassing local path limitations.

Frequently Asked Questions
Why do copied local links fail for my colleagues?
Local links include your specific Windows user profile name (e.g., C:\Users\YourName). When your colleague clicks the link, their computer looks for 'YourName' in their own user directory, which doesn't exist, causing an error.
Will Microsoft add a feature to automatically copy portable local paths?
Currently, Windows and Microsoft 365 do not have this feature built-in. Users are encouraged to submit feature suggestions via the Microsoft feedback portal (if you encounter an HTTP 401 error, sign in with your Microsoft account first).
How can I force standard SharePoint links to open in the desktop app instead of the web?
Users can change their link handling preferences in the Microsoft 365 web portal or Teams settings to always open Word, Excel, and PowerPoint files in the desktop application rather than the browser.
Can Mac users utilize the %USERPROFILE% method?
%USERPROFILE% is a Windows-specific environment variable. For cross-platform sharing between Windows and Mac users, you must use standard web-based OneDrive or SharePoint sharing links.




