This question relates to using Microsoft Teams and OneDrive.

The %OneDrive% environment variable can stand in for the local folder being used for personal OneDrive storage (e.g., 'C:\OneDrive - MyCompany' = %OneDrive%, if typed into Windows explorer).

Is there an environment variable that can stand in for a synced folder, to facilitate sharing links on Teams chat? E.g., I'm hoping to pass a quick link to a coworker in the form:

%OneDrive environment variable%\directory1\file.xyz

  • Please explain what you are trying to accomplish and not ask about how to implement the solution you have come up with for the yet unspecified task. Users can’t access files in another user’s profile folder. Whatever it is you are trying to do, there is a misunderstanding and it’s not right. Jun 11, 2019 at 15:35
  • Sure. Question has now been edited.
    – Shawn
    Jun 11, 2019 at 16:24
  • In a LAN, use \\computer\share\file. On the Internet, forget it.
    – harrymc
    Jun 11, 2019 at 19:50
  • I think you are expecting OneDrive to do something it wasn’t designed for. OneDrive shouldn’t play any role in sharing files on a LAN, unless it’s a sharepojnt site acting as a central repository for distributed workers. It’s still unclear if you just want files shared between users on the same computer or across a broader system and what that system is. Jun 11, 2019 at 22:20
  • @Appleoddity There is now (since ~2020) a feature that lets you create shortcuts in OneDrive that point to a Sharepoint Document Library - so a path of the following %OneDriveCommercial\<mysharepoint-shortcut> is a valid solution. May 24, 2021 at 14:42

1 Answer 1


The answer is to use %OneDriveCommercial% as the generic prefix to share paths among people using the same corporate OneDrive, e.g.,


For personal OneDrive, use %OneDriveConsumer%. If you have only one OneDrive client on your computer, %OneDrive% does the job.

  • So, on a PC with both a personal and work OneDrives; it appears that: 1. %OneDrive% sends to my work drive 2. %OneDriveCommercial% also goes to my work drive Is there a variable for personal drive? Thanks, T Feb 24 at 6:54
  • OneDriveConsumer=C:\Users\my_username\OneDrive works... Feb 24 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.