07
2023
04
17:36:10

使用bat脚本判断操作系统



推荐点击下面图片,通过本站淘宝优惠价购买:

image.png

说明:

该脚本首先判断当前操作系统,然后判断该系统是32位还是64位系统,最后根据不同的系统执行不同命令。

@echo off

ver | find "6.1." > NUL &&  goto win7 
ver | find "10.0." > NUL &&  goto win10
goto end

:win7
if exist "c:\agentinstalled.txt"   goto end
if not exist "c:\agentinstalled.txt" goto first

:win10
if exist "c:\agentinstalled.txt"   goto end
if not exist "c:\agentinstalled.txt" goto second

:first
if  "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
    
    echo      "first x64" > "c:\agentinstalled.txt"
)^
else if "%PROCESSOR_ARCHITECTURE%"=="x86" (
    
    echo     " first x86"  > "c:\agentinstalled.txt"
)
goto end


:second
if  "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
    
    echo     "second x64" > "c:\pagentinstalled.txt"
)^
else if "%PROCESSOR_ARCHITECTURE%"=="x86" (
    
    echo     "second x86  > "c:\agentinstalled.txt"
)
goto end


:end
exit


本文链接:https://www.hqyman.cn/post/3813.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:





休息一下,本站随机推荐观看栏目:


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

您的IP地址是: