How can I use VBScript to determine whether I am running a 32-bit or 64-bit Windows OS?

前端 未结 8 544
死守一世寂寞
死守一世寂寞 2020-12-25 08:46

How do i detect the bitness (32-bit vs. 64-bit) of the Windows OS in VBScript?

I tried this approach but it doesn\'t work; I guess the (x86) is causing some problem

8条回答
  •  盖世英雄少女心
    2020-12-25 09:47

    Determining if the CPU is 32-bit or 64-bit is easy but the question asked is how to determine if the OS is 32-bit or 64-bit. When a 64-bit Windows is running, the ProgramW6432 environment variable is defined.

    This:

    CreateObject("WScript.Shell").Environment("PROCESS")("ProgramW6432") = ""
    

    will return true for a 32-bit OS and false for a 64-bit OS and will work for all version of Windows including very old ones.

提交回复
热议问题