可将下列代码复制保护到批处理脚本中,自行运行测试
@Echo Off Title Set Off __Create by Chris@25/12/2014 Color 0B Echo 完整路径名File Full Path^&Name:________%~0 Echo 盘符Drive Letter:_____________________%~d0 Echo 仅路径Path Only:______________________%~p0 Echo 文件名File Name:______________________%~n0 Echo 文件扩展名File Extensions:____________%~x0 Echo 缩写全路径名:_________________________%~s0 Echo 文件属性File Properties:______________%~a0 Echo 创建时间Create Time:__________________%~t0 Echo 文件大小File Size:____________________%~z0 Echo 选项可组合:文件全名Full Name__________%~nx0 Echo= Set T=I Am Chris Echo 完整变量值T为:________________________"%T%" Echo 向右偏移1位,向右取3个字符:____________"%T:~1,3%" Echo 不偏移,向右取5个字符:_________________"%T:~0,5%" Echo 向右偏移4字符,向右取之后:_____________"%T:~4%" Echo 取最后5个字符:________________________"%T:~-5%" Echo 向左偏移5位,向右取3字符:______________"%T:~-5,3%" Echo 向右偏移5位,向右取之后,去除末尾3字符:_"%T:~-5,-3%" Echo= Echo 系统完整TIME变量值为:_________________"%time%" Echo 不偏移,向右取5个字符,仅得时和分:______"%time:~0,5%" Pause
或下载Set Off