在文本文件 .bat 文件中回显一个 for

Echo a for in a text file .bat file

当我 运行 我的 bat 文件关闭时。我确定问题出在这一行,因为 echo 正在尝试打印 %%a 值,但它是空的。我想要的只是 arranque.bat for /f "tokens=6" %%a in (information.txt) do set coin=%%a

出现错误的行:

echo for /f "tokens=6" %%a in (information.txt) do set coin=%%a >> arranque.bat

假设您要设置变量硬币 追加到文件

for /f "tokens=6" %%a in (information.txt) do (
    set "coin=%%a"
    >> arranque.bat echo=%%a
)

如果information.txt中有多行,每一行都会替换硬币内容,所以在for之后只有最后一行会保留。

根据您的编辑,如果我理解正确的话,您要找的是:

Echo For /F "UseBackQ Tokens=6" %%%%A In ("information.txt") Do Set "coin=%%%%A">>"arranque.bat"