@ECHO OFF & CD /D %~DP0 & TITLE 卸载
>NUL 2>&1 REG.exe query "HKU\S-1-5-19" || (
    ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
    ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
    "%TEMP%\Getadmin.vbs"
    DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL
    Exit /b
)

taskkill /f /im IDM* >NUL 2>NUL
taskkill /f /im IEMon* >NUL 2>NUL

If Exist "%Public%" Net Stop IDMWFP >NUL 2>NUL
If Not Exist "%Public%" Net Stop IDMTDI >NUL 2>NUL

If Exist "%Public%" Rundll32 setupapi.dll,InstallHinfSection DefaultUninstall 128 .\idmwfp.inf
If Not Exist "%Public%" Rundll32 setupapi.dll,InstallHinfSection DefaultUninstall 128 .\idmtdi.inf

If Exist "%WinDir%\SysWOW64" Regsvr32 /s /u IDMShellExt64.dll

rd/s/q "%AppData%\IDM"2>NUL
If Exist "%a%" rd/s/q "%ProgramData%\IDM" 2>NUL
rd/s/q "%AllUsersProfile%\Application Data\IDM"2>NUL
reg delete HKCU\Software\DownloadManager /v Email /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v Serial /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v LName /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v FName /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v scansk /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v tvfrdt /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v CheckUpdtVM /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v AppDataIDMFolder /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v CommonAppDataIDMFolder /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v ExePath /f>NUL 2>NUL
reg delete HKCU\Software\DownloadManager /v TempPath /f>NUL 2>NUL
reg delete "HKLM\SOFTWARE\Internet Download Manager" /f>NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wow6432Node\Internet Download Manager" /f>NUL 2>NUL
reg delete HKCU\Software\Classes\CLSID\{07999AC3-058B-40BF-984F-69EB1E554CA7} /f>NUL 2>NUL
reg delete HKCU\Software\Classes\CLSID\{6DDF00DB-1234-46EC-8356-27E7B2051192} /f>NUL 2>NUL
reg delete HKCU\Software\Classes\CLSID\{D5B91409-A8CA-4973-9A0B-59F713D25671} /f>NUL 2>NUL
reg delete HKCU\Software\Classes\CLSID\{7B8E9164-324D-4A2E-A46D-0165FB2000EC} /f>NUL 2>NUL
reg delete HKCU\Software\Classes\CLSID\{5ED60779-4DE2-4E07-B862-974CA4FF2E9C} /f>NUL 2>NUL
reg delete HKLM\Software\Classes\CLSID\{07999AC3-058B-40BF-984F-69EB1E554CA7} /f>NUL 2>NUL
reg delete HKLM\Software\Classes\CLSID\{6DDF00DB-1234-46EC-8356-27E7B2051192} /f>NUL 2>NUL
reg delete HKLM\Software\Classes\CLSID\{D5B91409-A8CA-4973-9A0B-59F713D25671} /f>NUL 2>NUL
reg delete HKLM\Software\Classes\CLSID\{7B8E9164-324D-4A2E-A46D-0165FB2000EC} /f>NUL 2>NUL
reg delete HKLM\Software\Classes\CLSID\{5ED60779-4DE2-4E07-B862-974CA4FF2E9C} /f>NUL 2>NUL
reg delete HKCU\Software\Classes\Wow6432Node\CLSID\{7B8E9164-324D-4A2E-A46D-0165FB2000EC} /f>NUL 2>NUL
reg delete HKCU\Software\Classes\Wow6432Node\CLSID\{5ED60779-4DE2-4E07-B862-974CA4FF2E9C} /f>NUL 2>NUL
reg delete HKLM\Software\Classes\Wow6432Node\CLSID\{7B8E9164-324D-4A2E-A46D-0165FB2000EC} /f>NUL 2>NUL
reg delete HKLM\Software\Classes\Wow6432Node\CLSID\{5ED60779-4DE2-4E07-B862-974CA4FF2E9C} /f>NUL 2>NUL
del /q "%userprofile%\Desktop\优酷客户端.lnk" >NUL  2>NUL 
del /q "%userprofile%\桌面\优酷客户端.lnk" >NUL  2>NUL 
taskkill /f /im explorer.exe >NUL 2>NUL & start explorer
CLS && ECHO.&ECHO.卸载完成！是否备份个人设置？
ECHO.&ECHO.是按任意键，否直接关闭窗口！&&PAUSE >NUL 2>NUL
regedit /e "IDM用户配置.reg" HKEY_CURRENT_USER\Software\DownloadManager >NUL 2>NUL
reg delete HKEY_CURRENT_USER\Software\DownloadManager /f>NUL 2>NUL
CLS && ECHO. & ECHO 卸载完成，请按任意键退出！ &&PAUSE >NUL & EXIT