windows - 批处理文件 :- Detect windows version and run exe file

标签 windows batch-file command-line exe

我想从批处理中检测 Windows 版本并根据结果启动 exe 文件

示例代码无效

@echo off
setlocal
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
if "%version%" geq "6.2" goto netfx_4
if "%version%" == "6.1" goto netfx_35
if "%version%" == "6.0" goto netfx_35

:netfx_35
 start "C:\Users\Ankur\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Notepad.lnk"
exit 1
goto :EOF

:netfx_4
start "C:\Users\Ankur\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Notepad.lnk"
exit 1
goto :EOF

endlocal

for testing on place of exe i start notepad file

但是这段代码不起作用。

最佳答案

>= 是无效的比较运算符。试试geq(其他的是equ neq lss leq gtr

关于windows - 批处理文件 :- Detect windows version and run exe file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43776143/

相关文章:

windows - nvcc 致命 : Compiler 'cl.exe' in PATH different than the one specified with -ccbin

batch-file - 检查 cmd shell 中的两个变量是否指向同一个文件夹的可靠方法

windows - 将文件从 Ubuntu 远程复制到 Windows 7

java - Windows(7?)上 Java 7 命令行的损坏的通配符扩展

windows - Tomcat如何将其可执行文件设置为Windows服务?

java - 在多个 CPU 内核上运行独立的 Hadoop 应用程序

windows - 设置 SVN 服务器?

python - 如何 pip 安装到外部驱动器?

python - Windows 7/8 上的 Django 1.6.2 - Python 3.3 - MySQL 5.6.17 连接器问题

python - 将参数通过 .bat 文件传递​​给 .exe 文件,由 'PyInstaller' 转换