Quickie: How do I assign a drive letter to my OneDrive folder that persists after reboot?
I have a customer with an old application that needs the user's home directory to be mapped to a drive letter. In a legacy on-premises environment, this is a trivial setting to create in AD. They're transitioning that application to a modern workstation with Onedrive for business, and that breaks it.
The workaround is to use the ancient subst command that ships with Windows to map the Onedrive file path to a drive letter. Create a batch file that contains this line and run it.
For Onedrive for business, use:
c:\windows\system32\Subst.exe q: "%OneDriveCommercial%"
For the consumer version of Onedrive use:
c:\windows\system32\Subst.exe p: "%OneDriveConsumer%"
A problem here is this does not persist across reboots. The user would have to rerun that batch file every time they restart. To fix that, move the batch file into the user's startup folder. For me that folder is "C:\Users\egreene\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup", but yours will be different. To go to the startup folder, open file explorer and type "shell:startup" in the address bar. It should automatically redirect to the correct location.