1、场景
只有一级目录
2、批处理脚本
CHCP 65001 @ECHO OFF ECHO "####################################################" ECHO "# Subject: update git repo #" ECHO "# Date: 2022.08.02 #" ECHO "# Author: tester #" ECHO "# Remark: remark #" ECHO "####################################################" SET CURRENT_DIR=%~dp0 ECHO "ROOT DIR: %CURRENT_DIR%" FOR /f "delims=" %%i IN ('dir /ad/b "%CURRENT_DIR%" ') DO ( IF EXIST %CURRENT_DIR%\%%i\.git ( ECHO "START update: %CURRENT_DIR%\%%i" CD %CURRENT_DIR%\%%i git pull ECHO "END update: %CURRENT_DIR%\%%i" ECHO "####################################################" ) ) CD ..
直接运行即可