@echo off set OneDrive="%SYSTEMROOT%\SysWOW64\OneDriveSetup.exe" echo ####### %0 ####### if NOT exist %OneDrive% ( echo OneDrive is NOT installed! echo ####### %0 ####### exit /b ) echo KILLING all OneDrive instances ... taskkill /f /im OneDrive.exe > NUL 2>&1 echo UNINSTALLING OneDrive ... rem %OneDrive% /uninstall 2>nul %OneDrive% /uninstall echo sleep 5 seconds ... ping 127.0.0.1 -n 5 > NUL 2>&1 echo CLEANUP OneDrive ... rd "%USERPROFILE%\OneDrive" /Q /S > NUL 2>&1 rd "C:\OneDriveTemp" /Q /S > NUL 2>&1 rd "%LOCALAPPDATA%\Microsoft\OneDrive" /Q /S > NUL 2>&1 rd "%PROGRAMDATA%\Microsoft OneDrive" /Q /S > NUL 2>&1 echo removing OneDrive from explorer ... reg DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > NUL 2>&1 reg DELETE "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > NUL 2>&1 reg DELETE "HKEY_CURRENT_USER\Software\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\ShellFolder" /f > NUL 2>&1 reg DELETE "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\ShellFolder" /f > NUL 2>&1 echo removing OneDrive update task ... powershell -Command "Get-ScheduledTask | Where-Object {$_.Taskname -match 'OneDrive Standalone Update'} | Unregister-ScheduledTask -Confirm:$false" echo KILLING all OneDrive SETUP instances ... taskkill /f /im OneDriveSetup.exe > NUL 2>&1 echo removing OneDrive setup exe ... setacl -on %OneDrive% -ot file -actn setowner -ownr "n:Administrators" 2>nul setacl -on %OneDrive% -ot file -actn ace -ace "n:Administrators;p:full" 2>nul del /Y %OneDrive% 2>nul echo ####### %0 #######