gpt4 book ai didi

batch-file - 批处理文件 - 循环将字符串附加到变量

转载 作者:行者123 更新时间:2023-12-03 20:21:45 25 4
gpt4 key购买 nike

这怎么会不断用循环中的每个数据替换变量而不是附加它?

set ipList=
for /F %%i in (ips.txt) do ( set ipList=%ipLis%,%%i )

最佳答案

您确实需要延迟扩展。其它的办法:

setlocal ENABLEDELAYEDEXPANSION
set ipList=
for /F %%i in (ips.txt) do ( set ipList=!ipList!,%%i )

注意“!”代替 '%%'。另外,您的问题中有一个错字,我想它应该是 %%ipList%% 而不是 %%ipLis%% (缺少“t”)。

关于batch-file - 批处理文件 - 循环将字符串附加到变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25621686/

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