[Batch] UnChew7 v0.1 for uninstalling Chew7 v1.0 / v1.1

Discussion in 'Scripting' started by anemeros, Mar 18, 2011.

  1. anemeros

    anemeros MDL Developer

    Aug 12, 2009
    #1 anemeros, Mar 18, 2011
    Last edited by a moderator: Apr 20, 2017
    @echo off
    setlocal enableextensions
    set this="%~0"
    if "%1" equ "1" (goto :at1)
    if "%1" equ "2" (goto :at2)
    set flaw=0
    set sr=%SystemRoot%
    set ss=%sr%\System32
    set sw=%sr%\SysWOW64
    set ncmd="%sr%\SysNative\cmd.exe"
    if not exist %ncmd% (set ncmd="%ss%\cmd.exe")
    set tcmd="%TEMP%\cmd1337.exe"
    if exist "%sw%\cmd.exe" (set arch=64) else (set arch=32)
    set x64=%ss%
    set x86=%sw%
    if %arch% equ 32 (set x86=%x64%)
    set bakf=%ALLUSERSPROFILE%\Microsoft\Windows\SXS
    set c1=reg delete HKLM\SOFTWARE\Chew7 /f^>nul
    set c2=del /f /q "%ss%\cwlog.dtl"
    set c3=rd /s /q %bakf%
    if exist "%sr%\ServerManager" (for /f "usebackq tokens=*" %%n in (`dir /s /b "%sr%\assembly\GAC_64\Microsoft.Windows.ServerManager\Microsoft.Windows.ServerManager.dll"`) do set mwsm=%%n) else (set mwsm=)
    echo.-- The Ghetto Chew7 Uninstaller v0.1 by anemeros --
    echo.(1)  Uninstall Chew7 v1.0
    echo.(2)  Uninstall Chew7 v1.1
    echo.(3)  Quit
    choice /c 123 /n /m ">"
    if %ERRORLEVEL% equ 1 (set tver=1.0)
    if %ERRORLEVEL% equ 2 (set tver=1.1&goto :common1)
    if %ERRORLEVEL% equ 3 (goto :eof)
    call :%tver%
    if %flaw% equ 0 (goto :success) else (goto :failure)
    goto :eof
    set st=schtasks /delete /tn \Microsoft\Windows\PMS
    %st%\PMS /f>nul
    %st%\ResetDTL /f>nul
    %st% /f>nul
    call :common2
    goto :eof
    call :zed 32 "%x86%\winver.exe"
    if %arch% equ 64 (call :zed 64 "%x64%\winver.exe")
    reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Chew7Hale /f>nul
    call :common2
    goto :eof
    set bf="%bakf%\%1\%~nx2"
    if not exist %2 (goto :eof)
    if not exist %bf% (goto :eof)
    takeown /f %2>nul
    icacls %2 /grant *s-1-1-0:f>nul
    set tf="%TEMP%\%RANDOM%%RANDOM%.tmp"
    if exist %tf% (goto :tmp) else (type nul>%tf%)
    move /y %2 %tf%>nul&&move /y %bf% %2>nul
    set /a flaw=flaw+%ERRORLEVEL%
    tasklist /fi "imagename eq %~1"|find /i "%~1">nul
    if %ERRORLEVEL% equ 0 (taskkill /f /im "%~1">nul)
    goto :eof
    copy /y %ncmd% %tcmd%>nul
    %tcmd% /c %this% 1
    reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v Chew7Hale /d "cmd.exe /c del /f /q /a:ash \"%ss%\hale.exe\"" /f>nul
    call :endtask "cmd.exe"
    %ncmd% /c %this% 2
    for %%a in (%tcmd%) do call :endtask "%%~nxa"
    del /f /q %tcmd%
    goto :resume
    call :zed 32 "%x86%\slmgr.vbs"
    call :zed 32 "%x86%\slwga.dll"
    call :zed 32 "%x86%\sppwmi.dll"
    if %arch% equ 32 (
    call :zed 32 "%x86%\user32.dll"
    call :zed 32 "%x86%\systemcpl.dll"
    call :zed 32 "%x86%\slui.exe"
    call :zed 32 "%x86%\sppcommdlg.dll"
    call :zed 32 "%x86%\sppuinotify.dll"
    call :zed 32 "%x86%\winlogon.exe"
    call :zed 32 "%x86%\wlms\wlms.exe"
    ) else (
    call :zed 64 "%x64%\slmgr.vbs"
    call :zed 64 "%x64%\slwga.dll"
    call :zed 64 "%x64%\sppwmi.dll"
    call :zed 64 "%x64%\user32.dll"
    call :zed 64 "%x64%\systemcpl.dll"
    call :zed 64 "%x64%\slui.exe"
    call :zed 64 "%x64%\sppcommdlg.dll"
    call :zed 64 "%x64%\sppuinotify.dll"
    call :zed 64 "%x64%\winlogon.exe"
    call :zed 64 "%x64%\wlms\wlms.exe"
    if "%mwsm%" neq "" (call :zed 64 "%mwsm%")
    if %flaw% equ 0 (%c3%)
    goto :eof
    goto :end
    if %flaw% neq 1 (set s=s were) else (set s= was)
    echo.Unfortunately, something has gone wrong and %flaw% error%s% encountered.
    echo.choice /c yn /n /m "Would you like me to run a system scan now?"
    if %ERRORLEVEL% equ 1 (
    echo.This process will take a while. Please do not interrupt it.&echo.
    sfc /scannow
    goto :end
    echo.&echo.All operations have finished.&echo.
    choice /c yn /n /m "Would you like me to restart your computer now?"
    if %ERRORLEVEL% equ 1 (shutdown /r /f /t 0 /d p:2:18)
    goto :eof

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...