BAT批处理实现字符串截取功能
程序员文章站
2022-06-17 13:33:17
获取当前的小时数:
@echo off
set hour=%time:~0,2%
if %hour% gtr 12 (
echo after...
获取当前的小时数:
@echo off set hour=%time:~0,2% if %hour% gtr 12 ( echo afternoon ) else ( echo morning )
打印windows的版本号:
@echo off for /f "tokens=1,2,3,4" %%i in ('ver') do ( set ver_temp=%%l ) set ver_major=%ver_temp:~0,1% set ver_minor=%ver_temp:~2,1% set ver_build=%ver_temp:~-5,4% echo windows version: echo major %ver_major% echo major %ver_minor% echo build %ver_build%
上一篇: maven 如何安装jar 到本地命令
下一篇: 一文带你揭秘SpringMvc参数值映射