×

使用bat脚本判断操作系统

hqy hqy 发表于2023-04-07 17:36:10 浏览1950 评论0

抢沙发发表评论

说明:

该脚本首先判断当前操作系统,然后判断该系统是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




推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

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

分享到:
打赏

群贤毕至

访客

您的IP地址是: