
저는 PC 수리점에서 일하고 있으며 효율성을 극대화하기 위해 cmd 스크립트를 사용하여 자동 설치를 구축하고 있습니다.
OS 종속 응용 프로그램(Windows 8 및 Windows 10용 Net Framework)에 갇혀 있습니다.
해당 OS에 앱을 설치하는 것보다 OS가 Windows 8인지 Windows 10인지 확인하는 cmd 명령(또는 스크립트)을 아는 사람이 있습니까?
답변1
arana의 도움으로 해결책을 찾았습니다. 링크
이 링크에서 Windows 운영 체제를 감지하는 스크립트를 볼 수 있지만 오류가 있습니다. 예를 들어 %errorlevel% 대신 errorlevel이 있고 eqaul = 대신 == 함수인 경우
echo off
ver | findstr "5.1" > nul
if %errorlevel% == 1 goto next0
if %errorlevel% == 0 goto xp
:next0
ver | findstr "6.0" > nul
if %errorlevel% == 1 goto next
if %errorlevel% == 0 goto win vista
:next
ver | findstr "6.1"
if %errorlevel% == 1 goto next1
if %errorlevel% == 0 goto win7
:next1
ver | findstr "6.2" > nul
if %errorlevel% == 1 goto next2
if %errorlevel% == 0 goto win8
:next2
ver | findstr "6.3" > nul
if %errorlevel% == 1 goto next3
if %errorlevel% == 0 goto win8.1
:next3
ver | findstr "6.3" > nul
if %errorlevel% == 1 goto next4
if %errorlevel% == 0 goto win8.1
:next4
ver | findstr "10.0" > nul
if %errorlevel% == 1 goto other
if %errorlevel% == 0 goto win10
:xp
echo XP
goto :eof
:win vista
echo Vista
goto :eof
:win7
echo Win7
goto :eof
:win8
echo Win8
goto :eof
:win8.1
echo Win8.1
goto :eof
:win10
echo Win10
goto :eof
:other
echo Early Win
goto :eof