改了试试- @echo off&setlocal enabledelayedexpansion
- for /f "tokens=2 delims=[版本" %%i in ('ver') do (set a=%%i&set b=!a:]=!&set c=!b: =!)
- if "%a:~1,3%" equ "5.1" echo WINXP=%c%
- if "%a:~1,3%" equ "5.2" echo WIN2003=%c%
- if "%a:~1,3%" equ "6.1" echo WIN7=%c%
- pause>nul
复制代码
- for /f "tokens=3,5 delims= " %%i in ('ver') do (set a=%%i&set b=%%j)
- echo WIN%a%=%b:~0,8%
- echo WIN%a%=%b:]=%
- pause
复制代码
- for /f "tokens=2,3,5 delims= " %%i in ('ver') do (set c=%%i&set a=%%j&set b=%%k)
- echo %c%%a%=%b:]=%
- pause
复制代码 最后修改- @echo off&setlocal enabledelayedexpansion
- for /f "tokens=2 delims=[版本" %%i in ('ver') do (set a=%%i&set b=!a:]=!&set c=!b: =!)
- if "%a:~1,5%" equ "5.00." echo WIN2000=%c%
- if "%a:~1,8%" equ "6.0.6000" echo WINVista=%c%
- if "%a:~1,8%" equ "6.0.6001" echo WIN2008=%c%
- if "%a:~1,5%" equ "5.1.2" echo WINXP=%c%
- if "%a:~1,5%" equ "5.2.3" echo WIN2003=%c%
- if "%a:~1,5%" equ "6.1.6" echo WIN7=%c%
- pause>nul
复制代码
|