How to map OneDrive to a drive letter in Windows 11

With an replace to Microsoft Home windows 11, you’ll be able to now not simply map OneDrive to a drive letter. As a substitute, it’s essential to resort to the traditional command line system often called DOS.

Picture: Cherry b l o s s o m/Shutterstock

Over the previous few years, TechRepublic has revealed a number of articles exhibiting you tips and suggestions that will let you designate a selected drive letter to Microsoft OneDrive. This was needed as a result of Microsoft now not permits it utilizing standard strategies. Nicely now, a reader has knowledgeable us that with the replace to Home windows 11, a kind of tips has turn into out of date. So, we should discover one other means.

As soon as upon a time, lengthy earlier than Home windows and graphical consumer interfaces, private computer systems have been run from the command line utilizing DOS. Lots of these historic legacy instructions are nonetheless viable, even in Home windows 11. That is the place we are going to discover the instructions we have to designate a selected drive letter to Microsoft OneDrive.

SEE: 3 must-have calculator instruments for the tech skilled (TechRepublic Premium)

Find out how to map OneDrive to a drive letter in Home windows 11

Earlier than we start, a few of you might be questioning why you’d wish to give OneDrive a drive letter within the first place. I realized a very long time in the past that in the case of how folks use their PCs, it’s best to float and assume there’s a good motive.

On this case, a reader requested for assist after discovering {that a} earlier tip now not labored. So, we’re serving to to unravel the issue the very best we are able to. That stated, what for those who have been writing a script in PowerShell that referenced OneDrive? Utilizing a drive letter as shorthand for a selected OneDrive folder might turn out to be useful.

SEE: Find out how to roll again Home windows 11 and return to Home windows 10 (TechRepublic)  

The very first thing we have to do is begin our command-line session with administrative rights. In Home windows 11, click on the search icon within the taskbar and sort “cmd” into the search field. Choose Run as Administrator from the choices checklist to succeed in the command line window proven in Determine A.

Determine A


To perform our job, we might be utilizing the “subst” command, which is brief for substitute. Its easy perform is to substitute a drive letter for a selected folder recognizable by the working system. The fundamental syntax appears to be like like:

subst [: [:]]

Essentially the most troublesome a part of this trick is figuring out precisely what path your set up of Microsoft OneDrive makes use of in line with the working system. To try this, we should make the most of some DOS-level listing browsing.

First kind “cd/” after which kind “dir”. These are the DOS change listing and the show listing instructions respectively, and we’re altering our focus to the foundation listing (Determine B) and getting a listing of subdirectories on the primary drive (almost definitely C:).

Determine B


The OneDrive listing is a subdirectory of a subdirectory of the Customers listing, so we kind “cd/Customers” on the command immediate after which request one other checklist of subdirectories by typing “dir” once more, as proven in Determine C.

Determine C


Now, that is the place it will get attention-grabbing. For my PC, the consumer listing is known as “mark” however on your PC it will likely be fully completely different. Regardless of the title, the subsequent command needs to be “cd/Customers/(fill in your listing title)”. For our instance, the instructions could be:


Your outcomes might be just like the display proven in Determine D. Word, it’s essential to kind within the full path for the command to work. A DOS limitation.

Determine D


In our instance, the title of my OneDrive listing is known as “OneDrive – Mark W Kaelin”. As you’ll be able to think about, referencing that in a script might be a nightmare. We are able to substitute a single drive letter (Z:) for that lengthy string of listing names utilizing this command:

subst z: "c:/Customers/mark/OneDrive - Mark W Kaelin"

Word using the citation marks. We should encompass our listing path in citation marks as a result of it comprises areas. DOS considers areas to be a break, which suggests it expects the subsequent little bit of textual content to be a brand new command. One other DOS limitation. After all, your OneDrive listing title will completely different from mine.

In the event you now, kind “z:” into the command immediate and sort “dir” you will note your Microsoft OneDrive listed in all of its DOS glory (Determine E).

Determine E


Shut out the command-line session after which load Home windows File Explorer. Once you scroll down the left-hand checklist of folders, you’ll discover Z: on the checklist of obtainable drives, as proven in Determine F.

Determine F


Sadly, this setting just isn’t everlasting. The following time your PC is restarted, this substitution might be misplaced and should be reapplied. If you wish to completely designate a drive letter to Microsoft OneDrive even throughout a restart, you’ll have to resort to a different historic method often called the autoexec batch file, which is a few deep DOS voodoo requiring its personal separate article.

Additionally see

Leave a Comment