Utilizing a little-known function of Home windows 10 and 11, we are able to routinely designate a selected drive letter to Microsoft OneDrive at startup each time we boot up our PC.
Beforehand, we outlined a technique for mapping a drive letter to Microsoft OneDrive utilizing the previous “subst” DOS command. This trick was wanted as a result of neither Home windows 10 nor Home windows 11 will enable customers to map OneDrive by standard strategies. Whereas using a DOS command is efficient, it’s not everlasting. Every restart or reboot of your PC will take away the mapping, so we should take the subsequent step to make it fixed.
Within the days of DOS we might make our mapped drive everlasting by an autoexec.bat file that runs throughout the boot course of, however that won’t work with Home windows 10 or Home windows 11. Nevertheless, we are able to nonetheless use a batch file to run our subst command at startup, however provided that we combine the previous with the brand new and hyperlink the file to the best folder.
SEE: OneDrive Cloud Utilization Coverage (TechRepublic Premium)
Completely map OneDrive to a drive letter with a batch file
For these of you not as historic as me, a batch file is a straightforward textual content file that Home windows interprets as a sequence of instructions. These are the sorts of instructions you’d difficulty from the usual command immediate. Most likely one of the best ways to explain it’s that batch recordsdata are a type of scripting
For our functions, we’ll create a easy textual content file with the “.bat” extension with just one line in it. It doesn’t matter the place this batch file is situated, however I might counsel someplace on the working system drive (sometimes C:). For our instance, we’ll use C:Apps.
Use Home windows File Explorer to navigate to the Apps folder, as proven in Determine A, and right-click on an open space within the righthand window. Choose New | Textual content Doc from the context menu.
Give your new textual content file a reputation however you’ll want to use the .bat extension. For our instance, we used Startup.bat.
Proper-click your batch file and choose Edit from the context menu. Home windows will open Notepad, and you will note an empty textual content file. Add the subst command that maps your required drive letter to Microsoft One Drive. In my case it’s:
subst z: “c:/Customers/mark/OneDrive – Mark W Kaelin”
Determine B reveals you what it seems like in Notepad.
Save the batch file and shut out Notepad. When you double-click your new batch file, it would run (most likely sooner than you may discover) and OneDrive will probably be mapped to a drive letter. Nevertheless, to get this batch file to run on startup, we should place a hyperlink to it within the particular Home windows 10 and Home windows 11 Startup folder.
Many customers are unaware of the Home windows Startup folder, however it may be helpful for working any software throughout the boot course of that doesn’t have that function already inbuilt. To achieve it, use the keyboard mixture shortcut Home windows Key + R to open the run command dialog field and sort “shell:startup”, as proven in Determine C.
Click on OK to open a session of File Explorer pointing to the Home windows Startup folder, as proven in Determine D. Proper-click an open space within the righthand window and choose New | Shortcut. You can be introduced with a dialog field the place you may browse to your batch file.
Browse to the place you saved your batch file (Determine E). While you discover the file, click on on it, after which click on the OK button. Click on Subsequent after which End. Shut out File Explorer when you find yourself achieved.
Now, once you have a look at the Home windows Startup folder, you will note a hyperlink to your batch file. So long as that shortcut is within the Home windows Startup folder, Microsoft OneDrive will probably be mapped to a selected drive letter in response to your preferences once you boot your PC.
When you resolve you not need Microsoft OneDrive mapped to a drive letter each time you boot your PC, merely take away the shortcut hyperlink from the Home windows Startup folder.