分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

作者:朱金灿

来源:http://blog.csdn.net/clever101

 

       为了使得批处理命令获取更大的通用性,有时需要获取操作系统版本。今天为此搜了一些资料,网上的说法是Ver、注册表、WMI都可以。我研究了一下,发现还是Ver命令最为成熟,为此综合各家做法写下了下面一个批处理文件:

 

@echo offclsver | find "4.0." > NUL &&  goto win95  ver | find "4.10." > NUL &&  goto win98 ver | find "4.90." > NUL &&  goto win_me ver | find "3.51." > NUL &&  goto win_Nt_3_5 ver | find "5.0." > NUL &&  goto win2000  ver | find "5.1." > NUL &&  goto win_xp  ver | find "5.2." > NUL &&  goto win2003  ver | find "6.0." > NUL &&  goto vista ver | find "6.1." > NUL &&  goto win7  ver | find "6.2." > NUL &&  goto win8  :[email protected]           当前系统是:[email protected] ----------------------------------------goto end:[email protected]           当前系统是:[email protected] ----------------------------------------goto end:[email protected]           当前系统是:[email protected] ----------------------------------------goto end:[email protected]           当前系统是:win NT [email protected] ----------------------------------------goto end:[email protected]           当前系统是:[email protected] ----------------------------------------goto end:[email protected]           当前系统是:[email protected] ----------------------------------------goto end:[email protected]           当前系统是:[email protected] ----------------------------------------goto end:[email protected]           当前系统是:[email protected] ----------------------------------------goto end:[email protected]           当前系统是:[email protected] ----------------------------------------goto end:[email protected]           当前系统是:[email protected] ----------------------------------------goto [email protected]           不能获取当前操作系统版本@echo ----------------------------------------:endpause

 

       下面是Windws 的主要版本列表:

                          批处理命令之精确获取操作系统版本信息

             

       需要指出的是上面的批处理命令获取的操作系统版本的取自版本的前两位,获取的操作系统信息依然不够准确的,如上表所示,如Windows 8Windows Server 2012的版本号都是6.2。所以在使用该批处理文件时需要注意这一点。

 

参考文献:

 

DOS 批处理命令判断操作系统版本执行各版本对应语句

 

  1. 批处理怎样判断操作系统的类型?

 

  1. OSVERSIONINFOEX structure (Windows)


          如果你觉得我的博客对你有帮助,请在下面网址中博客之星评选活动中投我一票:

http://vote.blog.csdn.net/item/blogstar/clever101(单击候选人介绍下面的投他一票那个按钮)

参与投票有机会获奖:

        最佳贡献奖:通过微博分享活动就有机会获得30元充值卡一张(每周抽选5名)
        幸运奖:凡参与投票用户就有机会获得精美小礼品一份。(每周抽选5名)
        积极参与奖:所有参与投票并符合条件的用户均可获得20个下载积分。




           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

批处理命令之精确获取操作系统版本信息

相关文章: