标题: [系统相关] 批处理如何实现根据系统版本的不同执行不同操作? [打印本页]
作者: vikimono 时间: 2016-4-12 17:32 标题: 批处理如何实现根据系统版本的不同执行不同操作?
本帖最后由 pcl_test 于 2016-4-12 20:05 编辑
发现使用Ver不能区分比如Win7与Server 2008
准备使用wmic os get Caption,一只处理不好,有高手能帮忙解决不,谢谢了
作者: vikimono 时间: 2016-4-12 19:12
研究了下,好像成了- @echo off
- for /f "skip=1 tokens=2,3,4,5,6" %%i in ('wmic os get Caption') do set win=%%i%%j%%k%%l
- echo %win%
- if /i %win%==Windows7Professional goto Win7
- if /i %Win%==WindowsServer2008R2 goto 2008R2
- goto End
- :Win7
- echo This is Windows 7 Professional English
- goto End
- :2008R2
- echo This is Windows Server 2008 R2 Enterprise
- :End
- pause
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |