Skip to content

Instantly share code, notes, and snippets.

@cworld1
Last active February 3, 2025 08:41
Show Gist options
  • Save cworld1/428c64bc075295e64230259644da3881 to your computer and use it in GitHub Desktop.
Save cworld1/428c64bc075295e64230259644da3881 to your computer and use it in GitHub Desktop.
MAA Resources Auto Update
@echo off
setlocal enabledelayedexpansion
set directory=MaaResource
REM Start MAA application
start ./MAA.exe
REM Check if .git directory exists
if not exist .git (
echo Cloning repository...
git clone https://github.com/MaaAssistantArknights/MaaResource %directory%
if errorlevel 1 (
echo Error occurred while cloning the repository.
pause
goto end
)
echo Copying files from %directory% to current directory...
robocopy "%directory%" "." /E /IS /IT /R:0 /W:0
if !ERRORLEVEL! EQU 0 (
echo Successfully copied files.
echo Removing directory %directory%...
rmdir /s /q "%directory%"
) else (
echo Error occurred while copying files. %directory% will not be removed.
pause
)
) else (
echo Pulling changes...
:loop
git checkout -- .
git pull
if errorlevel 1 (
echo Error occurred while pulling changes.
set /p retry="Press 'q' to exit or any other key to retry: "
if /i "!retry!"=="q" (
echo Exiting the loop.
goto end
) else (
echo Retrying...
goto loop
)
) else (
echo Successfully pulled changes.
goto end
)
)
:end
exit /b 0
@cworld1
Copy link
Author

cworld1 commented Feb 2, 2025

  1. 把这个脚本放到 MAA 根目录下
  2. 直接打开执行
  3. 测试无误后把该脚本发送快捷方式到你喜欢的地方
  4. 新的快捷方式可重命名+换图标成 MAA
  5. 把这个新的快捷方式当作 MAA 启动。每次启动都会先检查更新再自动启动 MAA。

注意事项:

  1. 需要有 Git,且 Git 网络配置需要足够稳定(建议自己查询如何永久设定代理)
  2. 第一次启动会有初始化的过程,请不要退出
  3. 担心脚本具破坏性的可以备份一下 config 文件夹,真玩坏了可以重装 maa 后配置塞回去
  4. 本来纯自用,概不负责,小问题可以在这里问,随缘回

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment