Need eyes on my new .bat file I made


SightUp

Well-known member
Local time
2:29 AM
Posts
120
OS
Windows
I created a new .bat file to uninstall OneDrive and all of it's left overs. I dare say this might be one of the more comprehensive ones out there. I need some eyes on it though and tell me if it will work as intended. Hopefully someone here might even be able to test it out for me.

Attached is the .bat. Note, I made it for a 64 bit OS and I don't know if it's complete for a 32 bit OS, not that it should matter.

Here is the code.

@echo off
cls

echo Closing OneDrive process.
echo.
taskkill /f /im OneDrive.exe

echo Uninstalling OneDrive.
%SystemRoot%\System32\OneDriveSetup.exe /uninstall
%SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall
echo.

echo Removing OneDrive leftovers.
rd "%UserProfile%\OneDrive" /s /q
rd "%LocalAppData%\Microsoft\OneDrive" /s /q
rd "%ProgramData%\Microsoft OneDrive" /s /q
rd "C:\OneDriveTemp" /s /q
del "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" /s /f /q
echo.

echo Removeing OneDrive from the Explorer Side Panel and cleaning the Registry.
REG Delete "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
REG Delete "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
REG Delete "HKLM\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
REG Delete "HKEY_USERS\S-1-5-19\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
REG Delete "HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f

:REG ADD "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v System.IsPinnedToNameSpaceTree /d "0" /t REG_DWORD /f
reg add HKLM\Software\Policies\Microsoft\Windows\OneDrive /v DisableFileSyncNGSC /t REG_DWORD /d 1 /f

PING -n 2 127.0.0.1>nul
pause

Couple of questions about it. I am combining about three different peoples scripts to come up with this.

:REG ADD "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v System.IsPinnedToNameSpaceTree /d "0" /t REG_DWORD /f

Is this line needed? I couldn't find much data on what it does specifically. It was added in two of the scripts I found though so I thought it must be semi important.

Here is the cmd prompt output that I got when I ran it.

1657247782424.png

Clearly I got a few errors because I ran a script on day one already that uninstalled OneDrive.

If I can get some feedback on this, that'd be wonderful!
 

Attachments

  • OneDrive Uninstaller.bat
    1.3 KB · Views: 5

My Computer

System One

  • OS
    Windows
    CPU
    Intel 8086k
    Motherboard
    Asus z370-F
    Graphics Card(s)
    EVGA 3080 Ti FTW3 Ultra
    Sound Card
    ADI-2 DAC fs
You don't need all that registry entries, uninstalling OneDrive will do.

Code:
Echo Off & Cls


IF DEFINED ProgramFiles(x86) (%SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall) Else (%SystemRoot%\System32\OneDriveSetup.exe /uninstall)

Exit
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Pavilion
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    Erica6
    Memory
    Micron Technology DDR4-3200 16GB
    Graphics Card(s)
    NVIDIA GeForce RTX 3060
    Sound Card
    Realtek ALC671
    Monitor(s) Displays
    Samsung SyncMaster U28E590
    Screen Resolution
    3840 x 2160
    Hard Drives
    SAMSUNG MZVLQ1T0HALB-000H1
The point of the registry entries is to completely remove all traces of it and prevent it from launching should Windows Update reinstall it for whatever reason. That doesn't happen if you simply install it.
 

My Computer

System One

  • OS
    Windows
    CPU
    Intel 8086k
    Motherboard
    Asus z370-F
    Graphics Card(s)
    EVGA 3080 Ti FTW3 Ultra
    Sound Card
    ADI-2 DAC fs
Here is my script (from several source)
Code:
:: REMOVE ONEDRIVE ::

:: Prevent OneDrive Installing for New Users
reg load HKLM\test c:\Users\default\ntuser.dat
reg delete "HKLM\test\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f
reg unload HKLM\test

:: Terminating OneDrive process.
taskkill /f /im OneDrive.exe

:: Uninstall OneDrive
set x86="%SystemRoot%\System32\OneDriveSetup.exe"
set x64="%SystemRoot%\SysWOW64\OneDriveSetup.exe"

if exist %x64% (
%x64% /uninstall
) else (
%x86% /uninstall
)

:: Removing remaining OneDrive folders.
rd "%UserProfile%\OneDrive" /s /q
rd "%LocalAppData%\Microsoft\OneDrive" /s /q
rd "%LocalAppData%\OneDrive" /s /q
rd "%ProgramData%\Microsoft OneDrive" /s /q
rd "%systemdrive%\OneDriveTemp" /s /q
del "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" /f /q
del "%windir%\SysWOW64\OneDriveSetup.exe" /f /q

:: Removing remaining  OneDrive registry keys.
REG DELETE "HKCR\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
REG DELETE "HKCR\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f

PAUSE
 

My Computer

System One

  • OS
    Windows 11 21H2 Home Single Language
    Computer type
    Laptop
    Manufacturer/Model
    Hometech ALFA400C
    CPU
    I'm ashamed to talk about it...
    Motherboard
    There is no such a God, I only know mother-Earth
    Memory
    3GB :(
    Graphics Card(s)
    on-board
    Sound Card
    on-board
    Monitor(s) Displays
    (s) is too ambitious for me
    Screen Resolution
    1920*1080
    Hard Drives
    Samsung SSD 860 EVO 250GB (SSD)
    Samsung MBG4GC 32GB (SSD)
    PSU
    I was very young when I last saw a PSU
    Case
    ...
    Cooling
    My coldness is enough to cool the computer
    Keyboard
    A broken and very clean keyboard
    Mouse
    Rat King
    Internet Speed
    Slowest internet connection in Europe
    Browser
    ChromePortable / TorBrowser
    Antivirus
    Biontech
    Other Info
    I can simply say that I took the red pill and I am not happy with it.

Latest Support Threads

Back
Top Bottom