Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1246856
  • 博文数量: 125
  • 博客积分: 4372
  • 博客等级: 上校
  • 技术积分: 1055
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-12 09:53
文章分类

全部博文(125)

文章存档

2019年(3)

2018年(2)

2017年(1)

2016年(2)

2015年(4)

2014年(11)

2013年(5)

2012年(4)

2011年(12)

2010年(10)

2009年(17)

2008年(17)

2007年(25)

2006年(12)

分类: WINDOWS

2012-08-08 16:03:02

基础知识,基础知识太差了。查了半天,先补补课吧。
“date:~0,10%是DOS里取日期的命令。

echo :~1,5%      //指针向右→偏移1位,然后从指针处开始向右→提取5个字符.

echo :~0,-3%    //指针不偏移,→提取所有字符,并除去最后3个字符.

echo :~5%        //单个数字,不指定长度值.表示指针→偏移5个字符,然后,→提取所有字符.

echo :~-5%      //单个负值,特例,表示指针反方向偏移,从最右端起,←偏移5位,然后从指针处开始→提取所有字符.也可以简单理解为提取字符串末尾5个字符。

C:\Documents and Settings\user>echo %date%
2012-08-08 星期三
C:\Documents and Settings\user>echo %date:~5,10%
08-08 星期三
C:\Documents and Settings\user>echo %date:~5,4%
08-0
C:\Documents and Settings\user>echo %date:~5,5%
08-08
C:\Documents and Settings\user>

阅读(15629) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

xuqianjin2015-06-13 09:35:07

不错,原理讲的很清晰

比这个贴 http://blog.itpub.net/3907/viewspace-1014155/ 更易懂