BAT批处理实现字符串截取功能
发布时间:2016-12-28 来源:查字典编辑
摘要:获取当前的小时数:@ECHOOFFSETHour=%TIME:~0,2%IF%Hour%GTR12(ECHOAfternoon)ELSE(E...
获取当前的小时数:
@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%