我正在尝试读取批处理脚本中的文件。我想打印文件的所有内容,但只返回最后一个。谁能帮我这个忙。
文件名-Modifyed.txt具有以下数据:
"forloop"
"modfiedfiles"
"test"
"test2"
"test_yati"
"final"
-----代码:
@echo off
FOR /f "tokens=*" %%A in (modfiedfiles.txt) do (
echo %%A
set variable1=%%A
set variable2=%variable1:~1,-1%
echo %variable2%
)
pause
执行上述代码后,输出为:
"forloop"
final
"modfiedfiles"
final
"test"
final
"test2"
final
"test_yati"
final
"final"
final
-期望的输出:
"forloop"
forloop
"modfiedfiles"
modfiedfiles
"test"
test
"test2"
test2
"test_yati"
test_yati
"final"
final