“在这个时候出乎意料."

问题描述:

我在批处理文件上运行此命令:

I'm running this command on a batch file:

for %I in (*.txt *.doc) do copy %I c:\test2

...它不断返回:

我在这个时候出乎意料.

I was unexpected at this time.

这个错误的原因是什么?

What is the cause of this error?

如果您在批处理/cmd 文件中运行,则需要加倍 % 标记:

If you're running within a batch/cmd file, you need to double the % markers:

for %%i in (*.txt *.doc) do copy %%i c:\test2

单个 % 变体仅适用于命令行.

The single % variant only works from the command line.