我的工作目录中有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
)
Run Code Online (Sandbox Code Playgroud)
结果如下:
---------------
file_variable=2.txt <---------------why it is not 1.txt here??
filename=1.txt
---------------
file_variable=2.txt
filename=2.txt
Run Code Online (Sandbox Code Playgroud)
谢谢.