IYUUPlus/windows_start.cmd
2022-10-03 11:21:36 +08:00

88 lines
2.4 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001
title IYUUPlus
cd /d "%~dp0"
echo Docker: https://hub.docker.com/r/iyuucn/iyuuplus
echo Gitee: https://gitee.com/ledc/iyuuplus
echo Github: https://github.com/ledccn/IYUUPlus
echo QQ: 859882209 / 931954050 / 924099912
echo Token: https://iyuu.cn
echo Blog: https://www.iyuu.cn
echo Docs: http://api.iyuu.cn/docs.php
echo.
goto :ping
:ping
echo "正在检查网络,请耐心等待..."
ping demo.iyuu.cn
echo.
goto :checkEnv
:checkEnv
echo "检查.env.example文件是否存在..."
if exist "%~dp0.env.example" goto :checkGit
echo "检查GIT尝试安装源码..."
git --version|find "git version">nul&&goto :install
goto :installError
:install
echo "正在使用GIT下载源码..."
git clone https://gitee.com/ledc/iyuuplus.git %~dp0IYUUPlus
echo "通过GIT安装完成开始检测php执行程序..."
cd IYUUPlus
goto :checkPHP
:installError
echo "当前运行环境未检测到GIT程序源码安装失败请手动下载"
echo "Docker: https://hub.docker.com/r/iyuucn/iyuuplus"
echo "Gitee: https://gitee.com/ledc/iyuuplus"
echo "Github: https://github.com/ledccn/IYUUPlus"
pause
goto :end
:checkGit
echo "检查GIT程序尝试自动更新源码..."
git --version|find "git version">nul&&goto :pull
echo "当前IYUUPlus运行环境未检测到git程序不支持自动更新。"
echo "推荐您使用git来下载代码库"
echo "您可以在安装git程序后在命令行内输入"
echo "git clone https://gitee.com/ledc/iyuuplus.git"
goto :checkPHP
:pull
echo "正在检测源码库的git特征文件..."
if exist "%~dp0.git\config" (
echo "正在为您自动更新..."
git fetch --all
git reset --hard origin/master
echo "更新完成!"
) else (
echo "当前IYUUPlus源码并非通过git拉取不支持自动更新"
)
echo.
goto :checkPHP
:checkPHP
if exist "%~dp0php\php.exe" (set PHP_BINARY=%~dp0php\php.exe) else (set PHP_BINARY=php.exe)
echo "PHP二进制程序"%PHP_BINARY%
%PHP_BINARY% -v|find "PHP Group">nul&&goto :start
echo "没有检测到PHP执行程序"
echo "如果您已下载过php程序请在解压缩后把php文件夹添加进系统的环境变量。"
echo "或者把php执行程序解压缩到当前目录下的php文件夹。"
echo "脚本运行终止!!!"
pause
goto :end
:start
%PHP_BINARY% -v
echo.
echo "如果您需要停止程序请按下组合键CTRL + C"
%PHP_BINARY% windows.php
pause
goto :end
:end
rem 结束
echo.