Batch to detect if system is a 32-bit or 64-bit

后端 未结 9 1423
心在旅途
心在旅途 2021-02-12 22:45

Does anybody know how to create a batch file that can shell one program if its a 64-bit system or shell another if its a 32-bit system?

9条回答
  •  旧巷少年郎
    2021-02-12 22:52

    This Line Will give you what you want, Works on XP, Vista and 7

    save it as .bat or .cmd

    If Defined ProgramFiles(x86) (\\Fileserver\Distribution\Softwarex64.exe) else (\\Fileserver\Distribution\Softwarex86.exe)
    

    If the Installation Source in the local Machine just point to it (D:\Programs\Softwarex64.exe)

    and if you want to just run commands and not to install, just type the command you want for x64 Between the first () and the commands for x86 Between the second ()

    If Defined ProgramFiles(x86) (ipconfig /all & @echo  This Is A 64-bit System ) else (arp -a & @echo This Is A 32-bit System)
    

    Copy this into your CMD to test it

    I hope this helps

提交回复
热议问题