batch-file - %%a 是什么意思? (批)

标签 batch-file batch-processing

%%a 是什么意思?
我了解上下文,但不了解如何使用它。
例如 :

FOR %%a in (%HELP%) DO echo I don't Know what it means

最佳答案

%%a指的是您的 for 循环将写入的变量的名称。

引自 for /? :

FOR %variable IN (set) DO command [command-parameters]

  %variable  Specifies a single letter replaceable parameter.
  (set)      Specifies a set of one or more files.  Wildcards may be used.
  command    Specifies the command to carry out for each file.
  command-parameters
             Specifies parameters or switches for the specified command.

To use the FOR command in a batch program, specify %%variable instead
of %variable.  Variable names are case sensitive, so %i is different
from %I.

示例 1:
for %%a in (A B C D E) do Echo %%a

生产
A
B
C
D
E

示例 2:
for %%a in (A B C) do (for %%b in (1 2 3) do Echo %%a:%%b)

生产
A:1
A:2
A:3
B:1
B:2
B:3
C:1
C:2
C:3

关于batch-file - %%a 是什么意思? (批),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28689850/

相关文章:

file - 批处理 - 有没有办法批量同步锁定txt文件?

windows - 自动检测是否从批处理中安装了防病毒软件

php - 如何使用 PHP 批量调整图像大小

csv - 是否可以使用宏将 csv 批量转换为 xls?

windows - 如何使用批处理更改项目中的特定字符串

windows-vista - Windows批处理文件: calling executable in another directory

batch-file - 当文件已经存在时,如何在批处理文件的开头退出批处理?

Windows批处理文件获取C :\drive total space and free space available

php - 长时间数据库操作的最佳方法?