@title 安装与更新
@cls
@echo off

::设置临时环境变量
@SET PATH="%~dp0Main\Tools";%PATH%
@SET PATH="%~dp0Main\Tools\python";%PATH%
@SET PATH="%~dp0Main\Tools\python\Scripts";%PATH%
@SET PATH="%~dp0Cmder_mini";%PATH%
@ echo.  
:MainMenu
@ echo.  
@ echo.  
@ echo.  首次使用annie是预装的，ykdl/youtube-dl/you-get可以根据自己需要安装
@ echo.  更新前建议先清理已安装的下载组件
@ echo.   
@ echo. 	========================
@ echo.    
@ echo.  	0. 清理已安装的下载组件
@ echo.    
@ echo. 	========================
@ echo.    
@ echo.  
@ echo.   安装下载组件：
@ echo.     
@ echo.   	1. 安装或更新ykdl
@ echo.  
@ echo.   	2. 安装或更新youtube-dl
@ echo.  
@ echo.  	3. annie默认已安装，此项是检查更新，如有更新自己手动更新
@ echo.  
@ echo.   	4. 安装或更新you-get
@ echo.  
@ echo.   	5. [可选] 用Cmder替换系统的命令行程序cmd(建议win7执行此项)
@ echo.      
set /p tools= 	输入数字选项按回车：

If "%tools%"=="1" Goto ykdl-U

If "%tools%"=="2" Goto youtube-dl-U

If "%tools%"=="3" Goto annie-U

If "%tools%"=="4" Goto you-get-U

If "%tools%"=="5" Goto cmder-U

If "%tools%"=="0" Goto clean

Echo.&Echo                输入无效，请重新输入！
ping -n 2 127.1 >nul
Goto MainMenu

:ykdl-U
python -m pip install --upgrade  https://github.com/zhangn1985/ykdl/archive/master.zip
Goto MainMenu

:youtube-dl-U
python -m pip install --upgrade youtube-dl
Goto MainMenu

:annie-U
@ echo.  
echo. 您当前的版本是
annie -v &start https://github.com/iawia002/annie/releases
pause
Goto MainMenu

:you-get-U
python -m pip install you-get
python -m pip install --upgrade you-get
Goto MainMenu

:cmder-U
>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
)
Start "%CD%\Cmder_mini\Cmder.exe" 
Cmder.exe /REGISTER ALL
Goto MainMenu

:clean
call "%CD%\Main\Cmd\clean.bat"
