Source language: Translate to:

Detecting Windows version

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Detecting Windows version

Postby Wrangler » Fri Aug 26, 2011 10:13 am

I can use:

RegistryRead "HKEY_LOCAL_MACHINE" "SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE" "[result2]"

to detect whether the processor is x64. (although on my win7 Intel machine it shows as AMD64).

Anyone know of a way to detect which flavor of Windows is installed? x86 or x64?

Edit: Found a lone post in a forum out there that answers my question:

On every single 64-bit Win7 PC I've checked, PROCESSOR_ARCHITECTURE value is *always* "AMD64", never "x64", and they all have Intel CPUs. On 32-bit OSs, it's always "x86".

It looks like this may be a minor coding goof on Microsoft's part.


Maybe someone out there who has a 64 bit processor but running Win7 x86 could verify this for me using the registry check above?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Neosoft Support » Fri Aug 26, 2011 11:11 am

Here's a VBScript function that will return the Windows OS bits:

Code: Select all
{NeoBook Function}
Version=5.70
Language=VBScript
Param=[%1]|Variable|Variable to store windows OS bits
{End}
Bits = GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth
publication.nbSetVar "[%1]", Bits


Returns either "32" or "64".
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Wrangler » Fri Aug 26, 2011 11:30 am

Thanks, Dave. Works a treat!
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1507
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby dpayer » Mon Aug 29, 2011 10:20 am

Wrangler wrote:Thanks, Dave. Works a treat!


Also available via WMI:

at a command line type:
wmic cpu >list.txt
[enter]


Then view the 2nd line of the list.txt file it creates.

David P.
User avatar
dpayer
 
Posts: 1384
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron