Determining 32/64 bit in Powershell

前端 未结 6 1961
梦谈多话
梦谈多话 2021-01-02 04:14

I am trying to create a couple lines of code that will pull from WMI if a machine is either 32/64 bit and then if it is 64 do this .... if it is 32bit do this...

Can

6条回答
  •  盖世英雄少女心
    2021-01-02 05:01

    [IntPtr]::Size -eq 4 # 32 bit
    

    The size of an IntPtr will be 4 bytes on a 32 bit machine and 8 bytes on a 64 bit machine (https://msdn.microsoft.com/en-us/library/system.intptr.size.aspx).

提交回复
热议问题