windows命令行获取时间

2021-06-10 16:32 阅读 52 次 windows命令行获取时间已关闭评论

获取系统日期:

%date%

获取系统时间:

%time%

修改时间连接符号

%date:~0,4%.%date:~5,2%.%date:~8,2%.%time:~0,2%.%time:~3,2%.%time:~6,2%%time:~8,3%

批处理参数传递

set "T=%date:~0,4%.%date:~5,2%.%date:~8,2%.%time:~0,2%.%time:~3,2%.%time:~6,2%%time:~8,3%"

输出参数T

echo %T%

示例:

C:\Users\Administrator>set "T=%date:~0,4%.%date:~5,2%.%date:~8,2%.%time:~0,2%.%t
ime:~3,2%.%time:~6,2%%time:~8,3%"

C:\Users\Administrator>echo %T%
2021.06.10.16.30.54.52

C:\Users\Administrator>

版权声明:本文著作权归原作者所有,欢迎分享,谢谢支持!
转载请保留注明:windows命令行获取时间 | DXL学习
分类:Commands 标签:

评论已关闭!