Overview
This guide explains how to map a specific OneDrive subfolder to a drive letter in Windows using the built-in SUBST command.
This method creates a virtual drive letter that points to a folder on your local system, including a synced OneDrive directory.
Important Notes
- This method works only if the OneDrive folder is fully synced locally.
- The mapped drive will disappear after a reboot unless additional steps are taken to make it persistent.
- Administrative rights are not typically required.
Step-by-Step Instructions
Step 1 - Ensure OneDrive Is Synced
1. Confirm that OneDrive is running.
2. Verify the folder you want to map is available locally and not cloud-only.
3. Note the full local path of the folder.
Example:
C:\Users\YourUserName\OneDrive\CompanyName\SubFolder
Step 2 - Open Command Prompt
1. Press the Windows key.
2. Type cmd.
3. Open Command Prompt.
Step 3 - Navigate to the Folder
Use the cd command to change to the directory you want to map.
Example:
cd "C:\Users\YourUserName\OneDrive\CompanyName\SubFolder"
Step 4 - Create the Drive Letter Mapping
Run the following command:
subst H: .
Important:
- There is a space after H:.
- The dot represents the current directory.
This maps the current folder to drive letter H:.
Verify the Mapping
1. Open File Explorer.
2. Select This PC.
3. You should now see drive H: listed.
Opening H: will take you directly to that OneDrive subfolder.
How to Remove the Mapping
If you need to remove the mapped drive, run:
subst H: /d
This will delete the virtual drive.
Making the Mapping Persistent (Optional)
By default, the SUBST mapping disappears after reboot.
To make it persistent:
1. Press Windows Key + R.
2. Type:
shell:startup
3. Create a new text file.
4. Add this line:
subst H: "C:\Full\Path\To\Folder"
5. Save the file as:
mapdrive.bat
Now the drive will remap automatically when the user logs in.
When to Use This Method
This is useful when:
- An application requires a drive letter instead of a UNC path.
- Legacy software does not work well with long OneDrive paths.
- You want easier navigation to a deep folder structure.