Identifying 64-Bit-Environments

You will find that one great advantage of 64bit-Environments is the address width of 8 bytes instead of 4 bytes. You can use this to identify whether a script runs in a 32-bit or 64-bit environment. You should simply take a look at pointers and their address width:

if ([IntPtr]::Size -eq 8) { "Ein 64-Bit-System" } else { "Ein 32-Bit-System" }

Twitter This Tip! ReTweet this Tip!


Posted Sep 20 2010, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.