需要编写一个批处理文件,根据Windows版本运行不同的命令.尝试使用以下批处理,它不起作用
@ECHO off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
FOR /f "tokens=1,2* delims=." %%a IN ('ver') DO (
SET WVer=%%a
SET WVer=!WVer:~-1!
SET WVer=!WVer!.%%b.%%c
SET WVer=!WVer:]=!
)
ECHO %WVer%
set result=false
if %WVer%==5.1.2600 set result=true
if %WVer%==5.2.3790 set result=true
if "%result%" == "true" (
GOTO XPor2003
)
if "%result%" == "false" (
GOTO nope
)
:XPor2003
echo XPor2003
:nope
echo nope
Run Code Online (Sandbox Code Playgroud)
我的评论副本:这是我在Windows XP上的批处理脚本的结果:
5.2.3790 x64
XPor2003
nope
Run Code Online (Sandbox Code Playgroud)
我只是想知道为什么nope会显示结果.我试图弄清楚为什么我的批处理脚本将控件转移到错误的标签
batch-file ×1