您现在的位置是:网站首页>列表内容
批处理变量应用方法_DOS/BAT_
2023-05-26 05:35:03
475人已围观
简介 批处理变量应用方法_DOS/BAT_
详细帮助参考:set /? cmd /? 务必仔细看!
具体应用:
1、获取变量子字符串:echo %date:~0,4%%date:~5,2%%date:~-2,2%%time:~0,2%%time:~3,2%%time:~6,2%
2、变量内容替换: set str=000111000 && echo %str:000=222% && echo %date:-=%%time::=%
3、延迟变量环境扩展:cmd /v:on
set /a j=0
for /l %i in (1,1,10) do set /a j=!j!+%i
具体应用:
1、获取变量子字符串:echo %date:~0,4%%date:~5,2%%date:~-2,2%%time:~0,2%%time:~3,2%%time:~6,2%
2、变量内容替换: set str=000111000 && echo %str:000=222% && echo %date:-=%%time::=%
3、延迟变量环境扩展:cmd /v:on
set /a j=0
for /l %i in (1,1,10) do set /a j=!j!+%i