Mapping A Drive Letter To OneDrive

    Robert Baehr  January 19 2022 02:19:50 AM
    Greetings:

    Given that everyone is on the cloud migration bandwagon, I thought I'd share a little simple "trick" that  I use to map a network drive to my OneDrive (note:  This works for Google Drive with some slight modification).


    While there are some other methods that I have found on-line, many appear cumbersome and, quite frankly, I could not get any of them to work. Keeping in mind that all environments are different, I took the following approach that should work for any Windows client environment.


    Instead of using the "Map Network Drive" option of Windows Explorer, I reverted back to my old DOS days and utilized the SUBST Command.   For those brought up in a post-DOS world, SUBST works like NET USE - it assigns a drive letter to a local folder on your PC.  The base syntax is:


    SUBST L: "Path"
    , where
    • L: is the drive letter you want to use
    • "Path" is the local folder that you want to map the L: drive to

    When you specify "Path", don't forget the double quotes.


    For my example, from a DOS prompt (there's that DOS word again), I mapped the Z: Drive to my OneDrive folder by issuing the following command:


    SUBST Z: "%USERPROFILE%\OneDrive"


    That's it!  If I look in explorer, I see a Z: drive.  If I am logged into OneDrive, any files added, deleted, or modified therein will sync to the cloud.  


    For ease of management, this command can be placed in a login (or other) script so that users have a familiar drive letter in which to reference their OneDrive files.


    Hope someone finds this useful - I know I do!




    Cheers!


    Robert Baehr

    The Unofficial Poster Child For Notes and Domino