@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 YunShellExt.dll
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" regsvr32 /s /u YunShellExt64.dll
if exist YunDetectService.exe Start /Wait /B "" "%~dp0YunDetectService.exe"  unreg
if exist BaiduNetdiskHost.exe ren BaiduNetdiskHost.exe  BaiduNetdiskHost.bak >NUL 2>NUL
if exist YunDetectService.exe ren YunDetectService.exe  YunDetectService.bak >NUL 2>NUL
reg add HKCU\Software\Baidu\BaiduYunGuanjia /v installDir /d "%~dp0\" /F>NUL
if "%PROCESSOR_ARCHITECTURE%"=="x86" reg add HKLM\SOFTWARE\Baidu\BaiduYunGuanjia /v installDir /d "%~dp0" /F>NUL
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" reg add HKLM\SOFTWARE\Wow6432Node\Baidu\BaiduYunGuanjia /v installDir /d "%~dp0\" /F>NUL
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\百度网盘.lnk""):b.TargetPath=""%~dp0BaiduNetdisk.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
: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 npYunWebDetect.dll
if exist YunDetectService.exe Start /Wait /B "" "%~dp0YunDetectService.exe"  unreg
if exist BaiduNetdiskHost.exe ren BaiduNetdiskHost.exe  BaiduNetdiskHost.bak >NUL 2>NUL
if exist YunDetectService.exe ren YunDetectService.exe  YunDetectService.bak >NUL 2>NUL
Echo.&Echo 已经禁用，按任意键返回！&PAUSE >NUL 2>NUL & CLS & GOTO MENU
: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 npYunWebDetect.dll
if exist BaiduNetdiskHost.bak ren BaiduNetdiskHost.bak  BaiduNetdiskHost.exe >NUL 2>NUL
if exist YunDetectService.bak ren YunDetectService.bak  YunDetectService.exe >NUL 2>NUL
if exist YunDetectService.exe Start /Wait /B "" "%~dp0YunDetectService.exe"  reg
Echo.&Echo 已经启用，按任意键返回！&PAUSE >NUL 2>NUL & CLS & GOTO MENU
:DelShellExt
if "%PROCESSOR_ARCHITECTURE%"=="x86" regsvr32 /s /u YunShellExt.dll
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" regsvr32 /s /u YunShellExt64.dll
Echo.&Echo 已经禁用，按任意键返回！&PAUSE >NUL 2>NUL & CLS & GOTO MENU
:AddShellExt
if "%PROCESSOR_ARCHITECTURE%"=="x86" regsvr32 /s YunShellExt.dll
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" regsvr32 /s YunShellExt64.dll
Echo.&Echo 已经启用，按任意键返回！&PAUSE >NUL 2>NUL & CLS & GOTO MENU