我已经到处寻找,但没有发现任何可以帮助我的东西。
我当前的代码是
if "%version%" == "6.0" echo Windows Vista is not supported by this program, as the commands this program uses are not in Windows Vista.
pause
exit
if "%version%" == "6.1" echo Windows 7 is not supported by this program, as the commands this program uses are not in Windows 7.
pause
exit
if "%version%" == "6.2" echo Windows 8 support with this program has not been tested, this program may not work if some commands that are used in this program are not in Windows 8, If you would like to continue, please press "1", press "0" if you would like to exit.
choice /c ecsf /m "Choose your option."
if %ERRORLEVEL% EQU 1 goto MENU
if %ERRORLEVEL% EQU 0 exit
if "%version%" == "6.3" echo Windows 8.1 support with this program has not been tested, this program may not work if some commands that are used in this program are not in Windows 8, If you would like to continue, please press "1", press "0" if you would like to exit.
choice /c ecsf /m "Choose your option."
if %ERRORLEVEL% EQU 1 goto MENU
if %ERRORLEVEL% EQU 0 exit
最佳答案
Windows 8 发布 version is 6.2.*不考虑补丁。
因此,您需要对没有补丁的版本和大于 61
的版本进行整数比较。您可以使用:
@echo off
for /f "tokens=2 delims=[" %%# in ('ver') do (
for /f "tokens=2,3 delims=. " %%a in ("%%#") do set r_vers=%%a%%b
)
echo %r_vers%
if %r_vers% LSS 62 (
echo you need at least Windows 8
pause
exit /b 1
)
echo continue with the script
pause
关于windows - 如何让用户的Windows版本低于Windows 8时程序退出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71418385/