This article guides you on how to completely reset the Microsoft OneDrive app on Windows and remove persistent folders or shortcuts that keep reappearing, using the Command Prompt (CMD) as Administrator.
When OneDrive experiences sync failures or keeps folders linked even after removing the account, the Windows background service may automatically recreate these folders. Performing a forced reset along with cleaning the directories and Registry resolves the issue permanently.
Procedure for complete reset and removal
Click the Start menu, type cmd, right-click on Command Prompt, and select Run as Administrator.
Copy the following command structure in full:
taskkill /f /im OneDrive.exe & ^
%localappdata%\Microsoft\OneDrive\onedrive.exe /reset & ^
%programfiles%\Microsoft OneDrive\onedrive.exe /reset & ^
%programfiles(x86)%\Microsoft OneDrive\onedrive.exe /reset & ^
timeout /t 3 /nobreak & ^
rmdir /s /q "%localappdata%\Microsoft\OneDrive" & ^
rmdir /s /q "%appdata%\Microsoft\OneDrive" & ^
reg delete "HKCU\Software\Microsoft\OneDrive" /f & ^
reg add "HKCR\CLSID\{018D5C66-453A-430B-9B53-224DE2ED1FE6}" /v System.IsPinnedToNameSpaceTree /t REG_DWORD /d 0 /fPaste the command into the Command Prompt window and press Enter.
What this command does on the system:
Restores the default paths for Desktop, Documents, and Pictures
Forcibly terminates the OneDrive process to release file locks
Executes Microsoft’s official reset command from the directory where the program is installed
Waits 3 seconds to ensure all services have completely stopped
Permanently removes the OneDrive folder from the user profile and the local and app data directories
Deletes the Windows Registry keys associated with the account to prevent automatic folder recreation
If there is an issue with the default Windows folders due to a backup configured in OneDrive, run:
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Desktop" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Desktop" /f & ^
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Documents" /f & ^
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Pictures" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Pictures" /f & ^
taskkill /f /im explorer.exe & start explorer.exe