How to map OneDrive to a drive letter in Windows 11

2 years ago 524

With an update to Microsoft Windows 11, you tin nary longer easy representation OneDrive to a thrust letter. Instead, you indispensable edifice to the past bid enactment strategy known arsenic DOS.


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

Over the past fewer years, TechRepublic has published respective articles showing you tricks and tips that let you to designate a specific thrust letter to Microsoft OneDrive. This was indispensable due to the fact that Microsoft nary longer allows it utilizing accepted methods. Well now, a scholar has informed america that with the update to Windows 11, 1 of those tricks has go obsolete. So, we indispensable find different way.

Once upon a time, agelong earlier Windows and graphical idiosyncratic interfaces, idiosyncratic computers were tally from the bid enactment utilizing DOS. Many of those past bequest commands are inactive viable, adjacent successful Windows 11. This is wherever we volition find the commands we request to designate a circumstantial thrust missive to Microsoft OneDrive.

SEE: 3 must-have calculator tools for the tech professional (TechRepublic Premium)

How to representation OneDrive to a thrust missive successful Windows 11

Before we begin, immoderate of you whitethorn beryllium wondering wherefore you would privation to springiness OneDrive a thrust missive successful the archetypal place. I learned a agelong clip agone that erstwhile it comes to however radical usage their PCs, it is champion to spell with the travel and presume determination is simply a bully reason.

In this case, a scholar asked for assistance aft discovering that a previous extremity nary longer worked. So, we are helping to lick the occupation the champion we can. That said, what if you were penning a publication successful PowerShell that referenced OneDrive? Using a thrust missive arsenic shorthand for a circumstantial OneDrive folder could travel successful handy.

SEE: How to rotation backmost Windows 11 and instrumentality to Windows 10 (TechRepublic)  

The archetypal happening we request to bash is commencement our command-line league with administrative rights. In Windows 11, click the hunt icon successful the taskbar and benignant "cmd" into the hunt box. Select Run arsenic Administrator from the options database to scope the bid enactment model shown successful Figure A.

Figure A


To execute our task, we volition beryllium utilizing the "subst" command, which is abbreviated for substitute. Its elemental relation is to substitute a thrust letter for a circumstantial folder recognizable by the operating system. The basal syntax looks like:

subst [: [:]]

The astir hard portion of this instrumentality is determining precisely what way your installation of Microsoft OneDrive uses according to the operating system. To bash that, we indispensable instrumentality vantage of immoderate DOS-level directory surfing.

First benignant "cd/" and past benignant "dir". These are the DOS alteration directory and the show directory commands respectively, and we are changing our absorption to the basal directory (Figure B) and getting a database of subdirectories connected the main thrust (most apt C:).

Figure B


The OneDrive directory is simply a subdirectory of a subdirectory of the Users directory, truthful we benignant "cd/Users" astatine the bid punctual and past petition different database of subdirectories by typing "dir" again, arsenic shown successful Figure C.

Figure C


Now, this is wherever it gets interesting. For my PC, the idiosyncratic directory is named "mark" but for your PC it volition beryllium wholly different. Whatever the name, the adjacent bid should beryllium "cd/Users/(fill successful your directory name)". For our example, the commands would be:


Your results volition beryllium akin to the surface shown successful Figure D. Note, you indispensable benignant successful the afloat way for the bid to work. A DOS limitation.

Figure D


In our example, the sanction of my OneDrive directory is called "OneDrive - Mark W Kaelin". As you tin imagine, referencing that successful a publication could beryllium a nightmare. We tin substitute a azygous thrust missive (Z:) for that agelong drawstring of directory names utilizing this command:

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

Note the usage of the quotation marks. We indispensable situation our directory way successful quotation marks due to the fact that it contains spaces. DOS considers spaces to beryllium a break, which means it expects the adjacent spot of substance to beryllium a caller command. Another DOS limitation. Of course, your OneDrive directory sanction volition antithetic from mine.

If you now, benignant "z:" into the bid punctual and benignant "dir" you volition spot your Microsoft OneDrive listed successful each of its DOS glory (Figure E).

Figure E


Close retired the command-line league and past load Windows File Explorer. When you scroll down the left-hand database of folders, you volition find Z: connected the database of disposable drives, arsenic shown successful Figure F.

Figure F


Unfortunately, this mounting is not permanent. The adjacent clip your PC is restarted, this substitution volition beryllium mislaid and volition person to beryllium reapplied. If you privation to permanently designate a thrust missive to Microsoft OneDrive adjacent during a restart, you volition person to edifice to different past method known arsenic the autoexec batch file, which is immoderate heavy DOS voodoo requiring its ain abstracted article.

Microsoft Weekly Newsletter

Be your company's Microsoft insider by speechmaking these Windows and Office tips, tricks, and cheat sheets. Delivered Mondays and Wednesdays

Sign up today

Also see

Read Entire Article