【发布时间】:2011-07-17 23:24:48
【问题描述】:
我的工作目录中有 1.txt 和 2.txt。我使用以下批次列出所有文件。
批次是这样的:
@echo off
for /f "tokens=*" %%a in ('dir *.txt /b') do (
echo ---------------
set file_variable=%%a
echo file_variable=%file_variable%
echo filename=%%a
)
结果如下:
---------------
file_variable=2.txt <---------------why it is not 1.txt here??
filename=1.txt
---------------
file_variable=2.txt
filename=2.txt
谢谢。
【问题讨论】:
标签: scripting batch-file cmd