我找到了一种让它与这个脚本一起工作的方法
FOR /F "SKIP=1 TOKENS=1-2 DELIMS=." %%A IN ('WMIC OS GET VERSION'
) DO FOR %%C IN (%%A%%B) DO IF %%C EQU 62 GOTO :windows8但这只适用于单个版本,我希望能够将条件添加到其他版本中。
我尝试过添加ELSE IF %%C EQU 100 GOTO :windows10,但是它不起作用
有人能帮我吗?
发布于 2022-10-27 18:27:31
您可以尝试这样做,以检查Windows版本:
@echo off
Title Check Windows Version
for /f "tokens=4-7 delims=[.] " %%i in ('ver') do (if %%i==Version (set v=%%j.%%k) else (set v=%%i.%%j))
if "%v%" == "10.0" set "myOS=Windows 10"
if "%v%" == "6.3" set "myOS=Windows 8.1"
if "%v%" == "6.2" set "myOS=Windows 8"
if "%v%" == "6.1" set "myOS=Windows 7"
if "%v%" == "6.0" set "myOS=Windows Vista"
if "%v%" == "5.2" set "myOS=Windows XP" & REM WinXP 64Bit Edition
if "%v%" == "5.1" set "myOS=Windows XP"
if "%v%" == "5.0" set "myOS=Windows 2000"
cls
echo Current OS version: %myOS%
pause >NUL
@exit /Bhttps://stackoverflow.com/questions/74226232
复制相似问题