Highlighted
Regular Contributor.
Regular Contributor.
4208 views

is there a login script variable to differentiate between 32bit or64bit Version of Windows ?

Hello,

is there a login script variable to differentiate between 32bit or 64bit
Version of Windows?

Regards, Adrian
Labels (1)
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

Re: is there a login script variable to differentiate between 32bit or 64bit Version of Windows ?

* Adrian Weiss (Tue, 16 Nov 2010 10:42:40 GMT)
> is there a login script variable to differentiate between 32bit or
> 64bit Version of Windows?


Not that I'm aware of. %OS, %OS_VERSION, %PLATFORM don't distinguish. I
would test for the existence of %ProgramW6432% (which is what I do in
batch scripts).

Something like

if <ProgramW6432> != "" then
write "this is 64-bit"
else
write "this is NOT 64-bit"
end


Thorsten
0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: is there a login script variable to differentiate betwee

Windows uses the PROCESSOR_ARCHITECTURE variable to describe whether it is running as x86 or AMD64. You can use that in your login scripts.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: is there a login script variable to differentiate between 32bit or 64bit Version of Windows ?

No login script variable but you can use the Windows variable
"PROCESSOR_ARCHITECTURE" which is "x86" for 32 bit and "AMD64" for 64
bit versions of WIndows. Works since Windows NT.

--
W. Prindl


Adrian Weiss wrote:

>Hello,
>
>is there a login script variable to differentiate between 32bit or
>64bit Version of Windows?
>
>Regards, Adrian


W. Prindl
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: is there a login script variable to differentiate between 32bit or64bit Version of Windows ?

* casutton (Tue, 16 Nov 2010 14:36:03 GMT)
> Windows uses the PROCESSOR_ARCHITECTURE variable to describe whether
> it is running as x86 or AMD64. You can use that in your login scripts.


I don't think this will work. What happens if you have a AMD64 processor
but are running 32-bit Windows on it? Just as an example for additional
problems: "For Windows Server 2003, the system always sets the value of
this entry to x86. However, this entry remains in the system to
anticipate future needs and to maintain compatibility with earlier
systems."[1]

Thorsten
[1] http://technet.microsoft.com/en-us/library/cc782199(WS.10).aspx
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: is there a login script variable to differentiate between 32bit or64bit Version of Windows ?

In my experience this does work. I use it on WINNT, W2K, WinXP,
WinXP64, WIN7 32 and WIN7 64, to differentiate user profiles between
architectures (and another variable to differentiate OS). Yes I don't
use it on Win2003 server, but on all client OS it works - and it
differentiates not the actual processor, but the OS flavour.
--
W. Prindl


Thorsten Kampe wrote:

>* casutton (Tue, 16 Nov 2010 14:36:03 GMT)
>> Windows uses the PROCESSOR_ARCHITECTURE variable to describe
>>whether it is running as x86 or AMD64. You can use that in your
>>login scripts.

>
>I don't think this will work. What happens if you have a AMD64
>processor but are running 32-bit Windows on it? Just as an example
>for additional problems: "For Windows Server 2003, the system always
>sets the value of this entry to x86. However, this entry remains in
>the system to anticipate future needs and to maintain compatibility
>with earlier systems."[1]
>
>Thorsten
>[1] http://technet.microsoft.com/en-us/library/cc782199(WS.10).aspx


W. Prindl
0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: is there a login script variable to differentiate betwee

Hmmm. I don't think that is the case. If you run a 32-bit OS on a 64-bit processor that variable will be x86 no matter what you do. If you run 64-bit Windows 7 you will notice that if you launch the 64-bit command prompt that it is set to AMD64. If you launch c:\windows\syswow64\cmd.exe you will notice that it will be set to x86.

That variable represents the Operating System architecture not the CPU architecture itself.

WOW64 Implementation Details (Windows)

I think their technet doc is wrong there or we are just looking at it out of context.

This article mentions that same registry key as the technet one that you found. How To Check If Computer Is Running A 32 Bit or 64 Bit Operating System.
However, it clearly states that it is the Operating System architecture that this describes.

You can also use ProgramW6432 because that is only used on 64bit systems. It is possible on some server hardware that you might get an IA64 instead of an AMD64 for PROCESSOR_ARCHITECTURE. But if you are doing this on workstations it probably doesn't matter which one you use.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: is there a login script variable to differentiate between 32bit or64bit Version of Windows ?

* casutton (Tue, 16 Nov 2010 23:06:02 GMT)
> If you run a 32-bit OS on a 64-bit processor that variable will be x86
> no matter what you do. If you run 64-bit Windows 7 you will notice
> that if you launch the 64-bit command prompt that it is set to AMD64.
> If you launch c:\windows\syswow64\cmd.exe you will notice that it will
> be set to x86.
>
> That variable represents the Operating System architecture not the CPU
> architecture itself.


Considering the above, you are right saying that PROCESSOR_ARCHITECTURE
doesn't represent the CPU architecture but you're wrong saying it
represents the Operating System architecture (since running different
versions of cmd on the same machine obviously doesn't change the
Operating System architecture)

> I think their technet doc is wrong there or we are just looking at it
> out of context.


It's about Windows 2003 exclusively.

> You can also use ProgramW6432 because that is only used on 64bit
> systems. It is possible on some server hardware that you might get an
> IA64 instead of an AMD64 for PROCESSOR_ARCHITECTURE. But if you are
> doing this on workstations it probably doesn't matter which one you
> use.


Considering the above I think it is more reliable to check for
ProgramW6432 than for PROCESSOR_ARCHITECTURE (since "x86" could mean
both: "this is 32-bit Windows" and "this is a 32-bit cmd on 64-bit
Windows".

On the other hand, in the original poster's scenario the login script
processor should run the system32 cmd which would give the correct
results. It's all a question of what is "good enough" in the specific
context.


Thorsten
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.