【发布时间】:2010-08-06 22:06:13
【问题描述】:
我有一个批处理文件,我需要像这样调用它“mybatch.bat -r c:\mydir”,批处理文件循环遍历目录并将文件名写入输出。我面临的问题是我无法读取参数“-r”。
它是这样的:
@echo off
echo [%date% %time%] VERBOSE START
for %%X in (%1\*.xml) do echo [%date% %time%] VERBOSE systemmsg Parsing XML file '%%X'
echo [%date% %time%] VERBOSE END
但是我可以使用 %2 而不是 %1 并且一切正常,但我想通过参数读取。这可能吗?
干杯!
【问题讨论】:
标签: batch-file named-parameters