Windows for 循环遍历目录,运行 git pull?

A T*_*A T 6 windows git windows-8 windows-8.1 cmd.exe

来自 Bash 很简单:

for d in *; do GIT_DIR="$d/.git" git pull; done
Run Code Online (Sandbox Code Playgroud)

或者:

for d in *; do GIT_DIR="$PWD/$d/.git" git pull; done
Run Code Online (Sandbox Code Playgroud)

然而,从 Windows 命令提示符它并不那么简单。我试过了:

for /D %i in (*.*) do cd "%i" && git pull
for /D %i in (*.*) do cd "<absolute_path>\%i" && git pull
for /D %i in (*.*) do set GIT_DIR="<absolute_path>\%i\.git git pull"
for /D %i in (*.*) do set GIT_DIR="<absolute_path>\%i\.git && git pull"
Run Code Online (Sandbox Code Playgroud)

但没有工作。总是收到以下错误之一:

fatal: unable to access '"repo-name/.git" /config': Invalid argument
The system cannot find the path specified.
Run Code Online (Sandbox Code Playgroud)

小智 7

这在 CMD 的批处理文件中对我有用:

for /d %%i in (*.*) do cd %%i & git pull & cd..
Run Code Online (Sandbox Code Playgroud)