How to use mklink for OneDrive For Business content sync?

By default, OneDrive will sync only the content inside its main folder. In such cases you need to copy all files and folders in the predefined location on your C partition. In any case, after some period of time, you will forget to copy some important data, and expose your data to the chance of content loss. How to prevent that?

Yes, you can automate all those backups for any folder on your Windows machine! To make OneDrive sync a folder which is not located in your main OneDrive folder, you have to  create a directory junction with mklink. You can simply create a symbolic link on local machine to sync important data from any folder into OneDrive For Business folder.

Correct syntax:  mklink [options] <Link> <Target>

Target is the file/folder that exists, and Link is the created one that links to the target. For Options type /j


  1. Open Command Prompt (Run as administrator)
  2. Type the following command: mklink /j “%UserProfile%\OneDrive\Folder name” “The full path to your folder”. You have to replace the ‘Folder name’ part with the desired name which will reproduce your folder in the OneDrive storage. Also, provide the correct path to the destination folder that you want to sync. For example:
    mklink /j “%UserProfile%\OneDrive\MyBackup” “c:\Contracts”


  • mklink can’t transmute directories into junctions, so the folder name (<Link> argument) has to be available before it can create the junction