@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 BaiduNetdisk.exe >NUL 2>NUL
taskkill /f /im YunDetectService.exe  >NUL 2>NUL
taskkill /f /im BaiduNetdiskHost.exe  >NUL 2>NUL
rd/s/q "%AppData%\Baidu\BaiduNetdisk"2>NUL
rd/s/q "%tmp%\bdyunguanjiaskinres"2>NUL
rd/s/q "%AppData%\BaiduYunGuanjia"2>NUL
rd/s/q "%AppData%\BaiduYunKernel"2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" regsvr32 /s /u App\YunShellExt.dll
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" regsvr32 /s /u App\YunShellExt64.dll
if exist App\YunDetectService.exe Start /Wait /B "" "%~dp0App\YunDetectService.exe"  unreg
if exist App\BaiduNetdiskHost.exe ren App\BaiduNetdiskHost.exe BaiduNetdiskHost.bak >NUL 2>NUL
if exist App\YunDetectService.exe ren App\YunDetectService.exe YunDetectService.bak >NUL 2>NUL
reg add HKCU\Software\Baidu\BaiduYunGuanjia /f /v installDir /d "%~dp0App" >NUL 2>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add HKLM\SOFTWARE\Baidu\BaiduYunGuanjia /f /v installDir /d "%~dp0App" >NUL 2>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add HKLM\SOFTWARE\Wow6432Node\Baidu\BaiduYunGuanjia /f /v installDir /d "%~dp0App\"  >NUL 2>NUL
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\百度网盘.lnk""):b.TargetPath=""%~dp0App\BaiduNetdisk.exe"":b.WorkingDirectory=""%~dp0App"":b.Save:close")
echo set WshShell = WScript.CreateObject("WScript.Shell")>tmp.vbs
echo set oShellLink = WshShell.CreateShortcut("%~dp0" ^& "\BaiduNetdisk.lnk")>>tmp.vbs
echo oShellLink.TargetPath ="%~dp0App\BaiduNetdisk.exe">>tmp.vbs
echo oShellLink.WindowStyle ="1">>tmp.vbs
echo oShellLink.IconLocation = "%~dp0App\BaiduNetdisk.exe">>tmp.vbs
echo oShellLink.Description = "">>tmp.vbs
echo oShellLink.WorkingDirectory = "%~dp0">>tmp.vbs
echo oShellLink.Save>>tmp.vbs
call tmp.vbs & del /f /q tmp.vbs >NUL 2>NUL
:Menu
Echo.&Echo   已经绿化完成，以下可按需选择：
Echo.&Echo  1、禁用接管浏览器下载及视频播放支持(默认)
Echo.&Echo  2、启用接管浏览器下载及视频播放支持(自选)
Echo.&Echo  3、禁用资源管理器右键上传到百度网盘项 (默认)
Echo.&Echo  4、启用资源管理器右键上传到百度网盘项 (自选)
Echo.&Echo.
set /p a=输入数字按回车：
If Not "%a%"=="" Set a=%a:~0,1%
If "%a%"=="1" Goto DelMenuExt
If "%a%"=="2" Goto AddMenuExt
If "%a%"=="3" Goto DelShellExt
If "%a%"=="4" Goto AddShellExt
Echo.&Echo 输入无效，请重新输入！
PAUSE >NUL & CLS & GOTO Menu
:DelMenuExt
taskkill /f /im BaiduNetdisk.exe >NUL 2>NUL
taskkill /f /im YunDetectService.exe  >NUL 2>NUL
taskkill /f /im BaiduNetdiskHost.exe  >NUL 2>NUL
regsvr32 /s /u App\npYunWebDetect.dll
if exist App\YunDetectService.exe Start /Wait /B "" "%~dp0App\YunDetectService.exe"  unreg
if exist App\BaiduNetdiskHost.exe ren App\BaiduNetdiskHost.exe  BaiduNetdiskHost.bak >NUL 2>NUL
if exist App\YunDetectService.exe ren App\YunDetectService.exe  YunDetectService.bak >NUL 2>NUL
SET E=完成!&GOTO MSGBOX
:AddMenuExt
taskkill /f /im BaiduNetdisk.exe >NUL 2>NUL
taskkill /f /im YunDetectService.exe  >NUL 2>NUL
taskkill /f /im BaiduNetdiskHost.exe  >NUL 2>NUL
regsvr32 /s App\npYunWebDetect.dll
if exist App\BaiduNetdiskHost.bak ren App\BaiduNetdiskHost.bak  BaiduNetdiskHost.exe >NUL 2>NUL
if exist App\YunDetectService.bak ren App\YunDetectService.bak  YunDetectService.exe >NUL 2>NUL
if exist App\YunDetectService.exe Start /Wait /B "" "%~dp0App\YunDetectService.exe"  reg
SET E=完成!&GOTO MSGBOX
:DelShellExt
if "%PROCESSOR_ARCHITECTURE%"=="x86" regsvr32 /s /u App\YunShellExt.dll
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" regsvr32 /s /u App\YunShellExt64.dll
SET E=完成!&GOTO MSGBOX
:AddShellExt
if "%PROCESSOR_ARCHITECTURE%"=="x86" regsvr32 /s App\YunShellExt.dll
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" regsvr32 /s App\YunShellExt64.dll
SET E=完成!&GOTO MSGBOX
:MsgBox
if "%1"=="" mshta VBScript:MsgBox("%e%",vbSystemModal,"")(close)&Cls&Goto Menu