When you set up OneDrive for Business for the first time or after reinstalling Windows, the process often stops at the “Preparing files” stage and never finishes. This happens because OneDrive must scan, index, and compare your local files with the cloud before it can start syncing. In many cases, the hang is caused by a large or fragmented local OneDrive folder, a corrupted cache, or a conflict with antivirus software that is scanning files in real time. This article explains why the setup gets stuck and provides a set of targeted fixes to complete the initial sync preparation.
Key Takeaways: Fixing a Stuck OneDrive Setup
- OneDrive cache reset via run command
onedrive.exe /reset: Clears corrupted temporary files that block the Preparing files stage. - Windows Security > Virus & threat protection > Manage settings > Exclusions: Exclude the entire OneDrive folder from real-time scanning to prevent antivirus delays.
- OneDrive > Settings > Sync and backup > Advanced settings > Files On-Demand: Enable this option before the initial sync to reduce the number of files that must be downloaded immediately.
Why OneDrive Setup Hangs on Preparing Files
The “Preparing files” step occurs after OneDrive connects to Microsoft 365 and before it begins downloading or syncing your files. During this phase, OneDrive builds a local index of every file in your OneDrive folder and compares it with the cloud manifest. If the folder contains thousands of small files, deeply nested subfolders, or files with very long paths, the indexing process can stall. A corrupted sync cache from a previous OneDrive installation is another common cause. The cache stores metadata about file versions, sync status, and timestamps. When this cache becomes damaged, OneDrive cannot complete the preparation phase. Antivirus software that scans every file during the indexing process can also slow the operation to a near stop, especially on systems with limited CPU or disk I/O capacity.
Steps to Fix OneDrive Setup Stuck on Preparing Files
The fixes below are ordered from least disruptive to most thorough. Start with the first method and proceed only if the issue persists.
Method 1: Reset OneDrive Using the Built-in Command
- Close OneDrive completely
Right-click the OneDrive cloud icon in the system tray and select Pause syncing > Quit OneDrive. If you do not see the icon, press Ctrl+Shift+Escape to open Task Manager, find OneDrive in the Processes list, right-click it, and choose End task. - Open the Run dialog
Press Win+R on your keyboard. - Run the reset command
Type the following command and press Enter:onedrive.exe /reset
A Command Prompt window may flash briefly. Wait 30 seconds for the process to finish. - Restart OneDrive
Press Win+R again, typeonedrive.exe, and press Enter. OneDrive will re-run the setup wizard. Sign in with your work or school account and let the preparation phase run for up to 10 minutes. If it still hangs, proceed to Method 2.
Method 2: Delete the OneDrive Cache Manually
If the reset command does not help, the cache files may be too damaged to be repaired automatically. Delete them manually.
- Quit OneDrive
Follow the same steps as in Method 1 to fully exit OneDrive. - Open File Explorer and enable hidden items
Click the View tab in File Explorer and check Hidden items. - Navigate to the cache folder
Go to the following folder:%localappdata%\Microsoft\OneDrive\settings
If you see a subfolder named Personal or Business, open it. - Delete the cache files
Delete all files and folders inside the settings folder. Do not delete the folder itself. If a file is in use, restart Windows and try again. - Restart OneDrive
Press Win+R, typeonedrive.exe, and press Enter. Sign in again. The preparation phase should complete within a few minutes.
Method 3: Add OneDrive Exclusions to Windows Security
Real-time antivirus scanning can dramatically slow down the indexing process. Exclude the OneDrive folder from scanning.
- Open Windows Security
Click Start, type Windows Security, and press Enter. - Go to Virus & threat protection
Click Virus & threat protection on the left sidebar, then click Manage settings under Virus & threat protection settings. - Add an exclusion
Scroll down to Exclusions and click Add or remove exclusions. Click Add an exclusion and choose Folder. Browse to your OneDrive folder, typicallyC:\Users\YourName\OneDrive - YourCompany, and select it. - Restart OneDrive
Quit and relaunch OneDrive. The preparation phase should now proceed without antivirus interference.
Method 4: Enable Files On-Demand Before the Initial Sync
Files On-Demand lets OneDrive show file placeholders instead of downloading every file immediately. This reduces the work done during the preparation phase.
- Open OneDrive settings
Right-click the OneDrive cloud icon in the system tray and select Settings. - Go to Sync and backup
Click the Sync and backup tab, then click Advanced settings. - Enable Files On-Demand
Under Files On-Demand, select Save space and download files as you use them. Click OK. - Restart OneDrive
Quit and relaunch OneDrive. The preparation phase should now complete faster because OneDrive will not attempt to download all files at once.
If OneDrive Still Has Issues After the Main Fix
OneDrive Setup Hangs on a Specific File
If the preparation phase stops at a particular file name, that file may have a name that exceeds 400 characters or contains unsupported characters such as \ / : ? " < > |. Move that file out of the OneDrive folder to a different location on your local drive, then restart OneDrive. After the setup completes, you can rename the file and move it back into the OneDrive folder.
OneDrive Stops Responding After the Preparing Files Stage
If setup finishes but OneDrive becomes unresponsive immediately after, the sync database may be corrupted. Run the reset command again, but this time use the /reset switch followed by a full unlink and relink of your account. From OneDrive settings, click Account > Unlink this PC. Then sign in again. This forces OneDrive to rebuild the sync database from scratch.
OneDrive Setup Hangs on a Windows 11 Computer with 8 GB or Less RAM
Low memory can cause the indexing process to stall. Close all other applications before running OneDrive setup. Open Task Manager with Ctrl+Shift+Escape and end any non-essential processes such as web browsers, Slack, or Teams. If the problem persists, temporarily disable startup programs using Task Manager > Startup and restart your computer.
OneDrive Setup Hangs: Manual Cache Reset vs Reset Command
| Item | Manual Cache Reset | Reset Command (onedrive.exe /reset) |
|---|---|---|
| Description | User deletes cache files from %localappdata%\Microsoft\OneDrive\settings by hand |
Built-in command that clears cache and re-registers OneDrive components |
| Time required | 5 to 10 minutes | 1 to 2 minutes |
| Effectiveness for corrupted cache | High — removes all cached metadata | Moderate — may not clear deeply corrupted files |
| Risk of data loss | None — local files remain untouched | None — local files remain untouched |
| Requires admin rights | No | No |
Use the reset command first because it is faster and less error prone. Switch to a manual cache reset only if the command does not resolve the hang.
After completing the fix, you can set up OneDrive normally. The preparation phase should now finish in under 10 minutes. To avoid this issue in the future, keep your OneDrive folder organized. Avoid storing more than 100,000 files in a single OneDrive library. Use the Files On-Demand setting to reduce the number of files that must be processed during setup. If you manage multiple users, push the Files On-Demand policy through Microsoft 365 admin center under Settings > OneDrive > Sync to prevent this hang from occurring on new devices.