总结

%%a refers to the name of the variable your for loop will write to.

Quoted from 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.

  

Example 中文 1:

for /f "tokens=1,2,3 delims=- " %%a in ('date /t') do (
echo %%a
echo %%b
echo %%c
)
对 date /t 的输出结果,每行取1、2、3列
第一列对应指定的 %%a ,后面的 %%b 和 %%c 是派生出来的,对应其它列
分隔符指定为 - 和"空格",注意 delims=- 后面有个"空格"
其中 tokens=1,2,3 若用 tokens=1-3 替换,效果是一样的

  

Example 中文 2:

for /f "tokens=2* delims=- " %%a in ('date /t') do echo %%b
取第2列给 %%a ,其后的列都给 %%b

  

Example 1:

for /f "tokens=1,* eol=: delims==" %%A in (%appdata%\gamelauncher\options.txt) do (
if "%%A"=="menu" set usemenu=%%B
)

  

Above snippet would now read the file line by line and for each line would discard everything after a colon (the eol=: option), use the equals sign as a token delimiter and capture two tokens: The part before the first = and everything after it.

The tokens are named starting with %%A so the second one is implicitly(含蓄的) %%B (again, this is explained in help for). Now, for each line we examine the first token and look whether it's menu and if so, assign its value to the usemenu variable.

Example 2:

for %%a in (A B C D E) do Echo %%a

Produces

A
B
C
D
E

Example 3:

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

Produces

A:1
A:2
A:3
B:1
B:2
B:3
C:1
C:2
C:3

Batch - FOR %%a %%b的更多相关文章

  1. redis大幅性能提升之使用管道(PipeLine)和批量(Batch)操作

    前段时间在做用户画像的时候,遇到了这样的一个问题,记录某一个商品的用户购买群,刚好这种需求就可以用到Redis中的Set,key作为productID,value 就是具体的customerid集合, ...

  2. Spring Batch在大型企业中的最佳实践

    在大型企业中,由于业务复杂.数据量大.数据格式不同.数据交互格式繁杂,并非所有的操作都能通过交互界面进行处理.而有一些操作需要定期读取大批量的数据,然后进行一系列的后续处理.这样的过程就是" ...

  3. Cesium原理篇:Batch

    通过之前的Material和Entity介绍,不知道你有没有发现,当我们需要添加一个rectangle时,有两种方式可供选择,我们可以直接添加到Scene的PrimitiveCollection,也可 ...

  4. spring batch资料收集

    spring batch官网 Spring Batch在大型企业中的最佳实践 一篇文章全面解析大数据批处理框架Spring Batch Spring Batch系列总括

  5. 【Hibernate框架】批量操作Batch总结

    在我们做.net系统的时候,所做的最常见的批量操作就是批量导入.插入.更新.删除等等,以前我们怎么做呢?基本上有以下几种方式: 1.利用循环调用insert方法,一条条插入. public boole ...

  6. CF724B. Batch Sort[枚举]

    B. Batch Sort time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  7. 从Bayesian角度浅析Batch Normalization

    前置阅读:http://blog.csdn.net/happynear/article/details/44238541——Batch Norm阅读笔记与实现 前置阅读:http://www.zhih ...

  8. Unity透明材质Batch

    NO Batch  ? 游戏场景中存在大量例子的时候,DrallCall的压力很大,但是遍历一遍之后发现,为啥一样的粒子特效竟然没有合并,why?经过很多测试后发现,如果把透明材质的修改为非半透明的, ...

  9. iBatis框架batch处理优化 (转)

    为什么要做batch处理        这个问题我就不解释了,因为我想你们肯定能比我解释的更好!如果你真的不知道,那就到Google上去搜索一下吧☻Oracle回滚段    这个问题偶也不很明白,只是 ...

  10. Spring Batch学习笔记三:JobRepository

    此系列博客皆为学习Spring Batch时的一些笔记: Spring Batch Job在运行时有很多元数据,这些元数据一般会被保存在内存或者数据库中,由于Spring Batch在默认配置是使用H ...

随机推荐

  1. 使用openntpd替换ntpd

    系统自带的ntp服务太难用,systemd启动几次没启动起来,懒得折腾,换了openntpd一次成功.

  2. vue 非父子组件之间的传值(Bus/总线/发布订阅模式/观察者模式)

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. centos7-关闭 rpcbind 服务

    1.关闭 rpcbind 服务 sudo systemctl disable rpcbind 2.关闭开机自启动 sudo  systemctl disable rpcbind 3.立即执行关闭 sy ...

  4. python实现收邮件判断模块poplib,email

    一.代码 # 输入邮件地址, 口令和POP3服务器地址: import datetime import email import poplib import email.policy from ema ...

  5. phpstorm使用说明

    1.phpstorm软件可以直接断点调试php代码.具体配置方法参考 http://blog.csdn.net/qq4551091/article/details/55258664 就可以了,不过只要 ...

  6. Java-Class-C:com.github.pagehelper.PageHelper

    ylbtech-Java-Class-C:com.github.pagehelper.PageHelper 1.返回顶部   2.返回顶部 1.1. import com.github.pagehel ...

  7. eclipse的快捷键(常用)

    ctrl+shift+r 全局查找java类 ctrl +h       全局查找包含某某内容的文件位置 ctrl +alt+h  右击方法名 选择open call hierarchy

  8. PHP面试 PHP基础知识 三(运算符)

    PHP运算符 PHP的运算符的错误控制符@ PHP支持一个错误运算符:@.当将其放在一个PHP表达式之前,该表达式可能产生的任何错误信息都将会被忽略掉. PHP运算符 运算符的优先级 着重记忆运算符 ...

  9. mac 安装brew mac安装expect mac一键登录服务器脚本

    mac 安装brew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/ma ...

  10. GIT 学习第二天 (二)

    工作区和暂存区 工作区: 就是你在电脑里能看到的目录,比如:webgit 文件夹 就是一个工作区 版本库: 工作区有一个隐藏目录 .git ,这个不算工作区,而是Git的版本库 Git的版本库里存了很 ...