BAT批处理实现字符串截取功能
程序员文章站
2022-03-08 08:29:38
获取当前的小时数:
@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%
下一篇: BAT批处理实现自动安装软件功能