gpt4 book ai didi

windows - 更新Windows文件夹中的所有git repos

转载 作者:可可西里 更新时间:2023-11-01 11:26:33 25 4
gpt4 key购买 nike

This答案是针对 linux 命令行的。我需要相同的 Windows 命令行。我使用 this 创建了以下内容,但我的代码不起作用。

for /D /r %i in (*.*) do (cd %i && echo %i && git pull && cd ..)

更新

根据@SevenEleven 的回答和@kostix 的评论,以下内容有效。

for /D %%i in (.\*) do (cd "%%i" && git pull && cd..)

for /D %%i in (*) do (cd "%%i" & git pull && cd..)

最佳答案

这应该可以完成工作:

for /D %%i in (.\*) do (cd %%i && echo %%i && git pull && cd ..)

此脚本搜索当前目录的子目录(for/D %%i in (.\*))。它更改到找到的每个目录 (cd %%i),将其名称写入控制台 (echo %%i) 并执行 git pull

/r 也会搜索所有子目录。由于您不想搜索项目子目录,因此不需要这样做。如果搜索绝对路径,则可以去掉 cd ..:

关于windows - 更新Windows文件夹中的所有git repos,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33877138/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com