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

前端 未结 8 488
死守一世寂寞
死守一世寂寞 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:29

    You can also check if folder C:\Windows\sysnative exist. This folder (or better alias) exist only in 32-Bit process, see File System Redirector

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set wshShell = CreateObject( "WScript.Shell" )
    
    If fso.FolderExists(wshShell.ExpandEnvironmentStrings("%windir%") & "\sysnative" ) Then
        WScript.Echo "You are running in 32-Bit Mode"
    Else
        WScript.Echo "You are running in 64-Bit Mode"
    End if
    

    Note: this script shows whether your current process is running in 32-bit or 64-bit mode - it does not show the architecture of your Windows.

提交回复
热议问题