希望有人能帮忙。我在 DOS 中工作(如果重要的话,Windows 7),并且得到了以下一小段代码:
@ECHO OFF
echo x:\junk\main\something\file1.txt > temp.txt
echo x:\junk\main\something\file2.txt >> temp.txt
echo x:\junk\main\else\file3.txt >> temp.txt
set TMP=temp.txt
setlocal enabledelayedexpansion
for /F %%I IN (%TMP%) DO (
echo File is: %%I
set CFile=%%I
set CFile=%CFile:~13%
echo File really is: %CFile%
)
运行它,生成以下结果:
C:\temp>test
File is: x:\junk\main\something\file1.txt
File really is:
File is: x:\junk\main\something\file2.txt
File really is:
File is: x:\junk\main\else\file3.txt
File really is:
C:\temp>
所以..我做错了什么?为什么不将值保存到 CFile 变量中?它似乎与 FOR 循环或 %%I 语法(与 %I% 相反)有关,但我不确定为什么?