Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

objShell.Run issues...

- - - - -

  • Please log in to reply
44 replies to this topic

#1
Falcor

Falcor

    Newbie

  • Member
  • 13 posts
  • Joined 28-February 13
  • OS:Windows 8 x64
  • Country: Country Flag
Hey guys/gals! At work, I do a lot of EDI processing. In order to cut down on the time it takes to locate each Excel spreadsheet, application, virtual machine, etc. I need to access while processing EDI, I have created an HTA utility that pretty much does everything I need: For each type of client EDI being processed, it executes specific applications, websites, yatta yatta.

Here's the rub: I have incorporated a check for the "Program Files (x86)" folder (a kind of 64-bit OS check). Since I have done this, I cannot get VMWare Infrastructure Client to run! When I create a test snippet with the same code and remove the objShell.Run command and replace it with a simple message box telling me what variables it has stored, everything is accurate. So, I simply cannot figure out how this is wrong...

Program Files check:
Set objShell = CreateObject("WScript.Shell")
ProgFilesPath = objShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%")

This works wonderfully - on 64-bit machines, it returns
C:\Program Files (x86)

On 32-bit machines, it returns
C:\Program Files

However, when I try to pass any of the following, I get a Path not found error...
objShell.run ProgFilesPath & "\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.201 -u root -p " & RootPassword.Value,1,False
PathTIE = chr(34) & objShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%") & "\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.204 -u root -p " & RootPassword.Value & chr(34)
objShell.run PathTIE,1,False

I have tried different permutations of quotes, both with and without and I simply can't get it to work! Can someone tell me what I am doing wrong?

Thanks, in advance, for your help!


How to remove advertisement from MSFN

#2
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,540 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Set objShell = CreateObject("WScript.Shell")  

ProgFilesPath = objShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")  

If Not objFSO.FolderExists(ProgFilesPath) Then

    ProgFilesPath = objShell.ExpandEnvironmentStrings("%ProgramFiles%")  



objShell.Run(Chr(34)ProgFilesPath & "\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & " -s 192.168.1.201 -u root -p " & RootPassword.Value & Chr(34), 1, False)


#3
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
This seems to be a problem read this Thread


GunSmokingMan



#4
Falcor

Falcor

    Newbie

  • Member
  • 13 posts
  • Joined 28-February 13
  • OS:Windows 8 x64
  • Country: Country Flag

Set objShell = CreateObject("WScript.Shell")  
ProgFilesPath = objShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")  
If Not objFSO.FolderExists(ProgFilesPath) Then
    ProgFilesPath = objShell.ExpandEnvironmentStrings("%ProgramFiles%")  

objShell.Run(Chr(34)ProgFilesPath & "\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & " -s 192.168.1.201 -u root -p " & RootPassword.Value & Chr(34), 1, False)


Sorry, I should have mentioned that this will be running as part of a sub. Thus, I cannot use parentheses.

#5
Falcor

Falcor

    Newbie

  • Member
  • 13 posts
  • Joined 28-February 13
  • OS:Windows 8 x64
  • Country: Country Flag

This seems to be a problem read this Thread


This doesn't seem to apply. I can run Msgbox commands out the whazzoo and it will return the correct path every single time, regardless of being run on a 32/64-bit machine.

Here is another test I ran where I hard coded the direct path to the executable:
Dim objFileSys, OSBit, objShell, PathTIE, PathTLW

Set objFileSys = CreateObject("Scripting.FileSystemObject")
If (objFileSys.FolderExists("C:\Program Files (x86)")) Then
	OSBit = "64"
Else
	OSBit = "32"
End If

If OSBit = "64" Then
	Set objShell = CreateObject("WScript.Shell")
	PathTIE = chr(34) & "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.204 -u root" & chr(34)
	PathTLW = chr(34) & "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.201 -u root" & chr(34)
	objShell.run PathTIE,1,False
	objShell.run PathTLW,1,False
ElseIf OSBit = "32" Then
	Set objShell = CreateObject("WScript.Shell")
	PathTIE = chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.204 -u root" & chr(34)
	PathTLW = chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe -s 192.168.1.201 -u root" & chr(34)
	objShell.run chr(34) & PathTIE & chr(34),1,False
	objShell.run chr(34) & PathTLW & chr(34),1,False
Else
	Msgbox "Error! No OS bit-level detected."
End If

This is simply strict VBScript...there is no HTA involved here...and it STILL says "Cannot find the file specified". Again, with the code above, I have tried just about every permutation of chr(34), """, "", ", etc. to try to see what the heck the issue is.

Thanks again for your replies.

#6
Falcor

Falcor

    Newbie

  • Member
  • 13 posts
  • Joined 28-February 13
  • OS:Windows 8 x64
  • Country: Country Flag
Hey guys. Looks like I solved my own problem. It appears as though the arguments I was passing with the run command have to be in a separate entity (Really MS??).

Here is the code I tested - It works without fail:
Dim objFileSys, OSBit, objShell, PathTIE, PathTLW, TIEArgs, TLWArgs

TIEArgs = " -s 192.168.1.204 -u root"
TLWArgs = " -s 192.168.1.201 -u root"

Set objFileSys = CreateObject("Scripting.FileSystemObject")
If (objFileSys.FolderExists("C:\Program Files (x86)")) Then
	OSBit = "64"
Else
	OSBit = "32"
End If

If OSBit = "64" Then
	Set objShell = CreateObject("WScript.Shell")
	PathTIE = chr(34) & "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & chr(34)
	If (objFileSys.FileExists(PathTIE)) Then
		Msgbox PathTIE & TIEArgs
	Else
		Msgbox PathTIE
	End If
	PathTLW = chr(34) & "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & chr(34)
	If (objFileSys.FileExists(PathTLW)) Then
		Msgbox PathTLW & TLWArgs
	Else
		Msgbox PathTLW
	End If
	objShell.run PathTIE & TIEArgs,1,False
	objShell.run PathTLW & TLWArgs,1,False
ElseIf OSBit = "32" Then
	Set objShell = CreateObject("WScript.Shell")
	PathTIE = chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & chr(34)
	If (objFileSys.FileExists(PathTIE)) Then
		Msgbox PathTIE & TIEArgs
	Else
		Msgbox PathTIE
	End If
	PathTLW = chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" & chr(34)
	If (objFileSys.FileExists(PathTLW)) Then
		Msgbox PathTLW & TLWArgs
	Else
		Msgbox PathTLW
	End If
	objShell.run PathTIE & TIEArgs,1,False
	objShell.run PathTLW & TLWArgs,1,False
Else
	Msgbox "Error! No OS bit-level detected."
End If

Strange, huh?

#7
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
1:\ If you where to place this at the top of the script Set objShell = CreateObject("WScript.Shell") you
would only need 1 instead of the 3 you have.

2:\ Here is another way to check if it X86 orX64 Os
Dim SysVar : Set SysVar = Act.Environment("System")

  If Right(SysVar("PROCESSOR_ARCHITECTURE"),2) = "64" Then
    WScript.Echo "64 Bit Os : " & SysVar("PROCESSOR_ARCHITECTURE")
  Else
    WScript.Echo "32 Bit Os : " & SysVar("PROCESSOR_ARCHITECTURE")
  End If

Produced this result 64 Bit Os : AMD64

3:\ it would be better to make a new Variable for this path, doing it the way you have it means you would
have to change 4 things if the path changes. Using a variable means only changing one path for the whole
script.
 Dim aPath :aPath=Chr(34) & "C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe"  & Chr(34)



GunSmokingMan



#8
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag
Sorry, but I don't think that this is a valid test for OS "bitness":

2:\ Here is another way to check if it X86 orX64 Os

Dim SysVar : Set SysVar = Act.Environment("System")

  If Right(SysVar("PROCESSOR_ARCHITECTURE"),2) = "64" Then
    WScript.Echo "64 Bit Os : " & SysVar("PROCESSOR_ARCHITECTURE")
  Else
    WScript.Echo "32 Bit Os : " & SysVar("PROCESSOR_ARCHITECTURE")
  End If

Produced this result 64 Bit Os : AMD64


since you can have a 32-bit OS installed on a 64-bit capable processor.

A more accurate test (in batch, but can obviously be easily changed to the script language of your choice), is:

SET "xOS=x64"& IF /I "%PROCESSOR_ARCHITECTURE%"=="x86" (IF NOT DEFINED PROCESSOR_ARCHITEW6432 SET "xOS=x86") 
ECHO %xOS%

A discussion on detecting the OS "bitness", along with reference links, can be found here.

Cheers and Regards

Posted Image


#9
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag

Sorry, but I don't think that this is a valid test for OS "bitness":

Can you read I said another way, as to how the poster posted, I never said the most accurate.
If (objFileSys.FolderExists("C:\Program Files (x86)")) Then

Here is a accurate ways of doing it, only valid on Vista and up
This get the architecture of the operating system, as opposed to that of the processor.
Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\CIMV2")
Dim Obj 

  For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_OperatingSystem")
   MsgBox Obj.OSArchitecture
  Next

Another way to get the processor architecture used by the platform code
Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\CIMV2")
Dim Obj, Var 
  For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_Processor")  
   Select Case Obj.Architecture
    Case 0 : Var = "x86"
    Case 1 : Var = "Mips"
    Case 2 : Var = "Alpha"
    Case 3 : Var = "PowerPc"
    Case 5 : Var = "Arm"
    Case 6 : Var = "Itanium-based systems"
    Case 9 : Var = "x64"
   End Select  
  Next   
  MsgBox "Architecture Type : " & Var 



Another way this will return 32 Bit on a x86 OS and this 64 bit on X64 OS
Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\CIMV2")
  For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_Processor") 
    MsgBox "Os Bit : " & Obj.AddressWidth
  Next 

I did not known about PROCESSOR_ARCHITEW6432, but using it returns 32 Bit Os : AMD64, I
am on X64 Windows 7 Ultimate
Dim SysVar : Set SysVar = Act.Environment("System")
'PROCESSOR_ARCHITECTURE
  If Right(SysVar("PROCESSOR_ARCHITEW6432"),2) = "64" Then
    WScript.Echo "64 Bit Os : " & SysVar("PROCESSOR_ARCHITECTURE")
  Else
    WScript.Echo "32 Bit Os : " & SysVar("PROCESSOR_ARCHITECTURE")    
  End If 
Script Results


GunSmokingMan



#10
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag
Yes, using PROCESSOR_ARCHITEW6432 is tricky, and its value is only valid when used together with PROCESSOR_ARCHITECTURE as described by David Wang at MS, whom everyone seems to refer to on the matter:

Detection Matrix



The general idea is to check the following environment variables:

  • PROCESSOR_ARCHITECTURE - reports the native processor architecture EXCEPT for WOW64, where it reports x86.
  • PROCESSOR_ARCHITEW6432 - not used EXCEPT for WOW64, where it reports the original native processor architecture.

Visually, it looks like:

Environment Variable \ Program Bitness        32bit Native        64bit Native        WOW64
PROCESSOR_ARCHITECTURE                            x86                AMD64             x86
PROCESSOR_ARCHITEW6432                         undefined           undefined          AMD64
  • WOW64 = 32bit Program on 64bit OS
  • Replace AMD64 with IA64 for Itaniums

Detection Logic



The logic that I use from a program to detect whether the OS is 32bit or 64bit looks like this:

IF PROCESSOR_ARCHITECTURE == amd64 OR
PROCESSOR_ARCHITEW6432 == amd64 THEN
// OS is 64bit
ELSE
// OS is 32bit
END IF

Another way to test for the same thing is:

IF PROCESSOR_ARCHITECTURE == x86 AND
PROCESSOR_ARCHITEW6432 NOT DEFINED THEN
// OS is 32bit
ELSE
// OS is 64bit
END IF


Posted Image


#11
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
My point was PROCESSOR_ARCHITEW6432 can not be used in VBS script,
it return "" or 0 character length in VBS

Example VBS
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim SysVar : Set SysVar = Act.Environment("System")

  If SysVar("PROCESSOR_ARCHITEW6432") = "" Then
   WScript.Echo "Empty Value No Information Test 1"
  Else
   WScript.Echo "Type : " & SysVar("PROCESSOR_ARCHITEW6432")
  End If 
  
  If Len(SysVar("PROCESSOR_ARCHITEW6432")) = 0 Then
   WScript.Echo "Empty Value No Information Test 2"
  Else
   WScript.Echo "Type : " & SysVar("PROCESSOR_ARCHITEW6432")
  End If 

Returns
Empty Value No Information Test 1
Empty Value No Information Test 2



GunSmokingMan



#12
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag

My point was PROCESSOR_ARCHITEW6432 can not be used in VBS script,
it return "" or 0 character length in VBS

Example VBS

Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim SysVar : Set SysVar = Act.Environment("System")

  If SysVar("PROCESSOR_ARCHITEW6432") = "" Then
   WScript.Echo "Empty Value No Information Test 1"
  Else
   WScript.Echo "Type : " & SysVar("PROCESSOR_ARCHITEW6432")
  End If 
  
  If Len(SysVar("PROCESSOR_ARCHITEW6432")) = 0 Then
   WScript.Echo "Empty Value No Information Test 2"
  Else
   WScript.Echo "Type : " & SysVar("PROCESSOR_ARCHITEW6432")
  End If 

Returns
Empty Value No Information Test 1
Empty Value No Information Test 2


For your tests that is probably correct. PROCESSOR_ARCHITEW6432 is only defined at all if and only if you are on a 64-bit OS AND you are running a 32-bit process at that instant, in other words if you are running a 32-bit app. In that one particular circumstance it will be equal to "AMD64", if you are on a 64-bit OS, otherwise its value is undefined so you will get the empty zero length value that you got. But its value is important to check for since in that same unique circumstance that PROCESSOR_ARCHITEW6432 is defined, PROCESSOR_ARCHITECTURE will be equal to "x86" even though you are running a 64-bit OS on a 64-bit processor. I'm not sure how you can force that condition for your VBS test.

Cheers and Regards

Posted Image


#13
Geej

Geej

    Senior Member

  • Member
  • PipPipPipPip
  • 635 posts
  • Joined 01-January 08
  • OS:XP Pro x86
  • Country: Country Flag
I think gunsmokingman method using Obj.AddressWidth is good enough. (post #9)
Here is another one liner code using Obj.AddressWidth I found.

The importance of checking bitness is to know the OS's bitness, not CPU bitness.
Correct me if I'm wrong, since we can't install x64 OS when CPU is only 32-bit-capable, it makes sense to check OS bitness only.

As I also noted, INF has .NTx86, .ntamd64, .ntia64 or .nt section
These sections are purely base on OS bitness.
Hence what is important during installation is the OS's bitness, not CPU's bitness.

For the OP initial problem ("Cannot find the file specified"), I think we can simply further using oShell.CurrentDirectory (like cmd pushd command)
Just my thought...

#14
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag

PROCESSOR_ARCHITECTURE will be equal to "x86" even though you are running a 64-bit OS on a 64-bit processor.


Wrong notice the script report AMD64, a script using WmiCodeCreator report 64 , System Properties show 64 Bit Os

Attached File  Pro_Arch.png   211.97KB   3 downloads

Geej is correct read what the MSDN AddressWidth is for


GunSmokingMan



#15
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag


PROCESSOR_ARCHITECTURE will be equal to "x86" even though you are running a 64-bit OS on a 64-bit processor.


Wrong notice the script report AMD64, a script using WmiCodeCreator report 64 , System Properties show 64 Bit Os

Attached File  Pro_Arch.png   211.97KB   3 downloads

Geej is correct read what the MSDN AddressWidth is for



How was that wrong? I would interpret your script results to mean that you were running a 64-bit process.

And I do not disagree with Geej. Actually, I won't disagree with either one of you. You both know far more about VBScript that I do. I was just passing along the info and definition of the system variables and how to use them to get the OS bitness directly from MS. It wouldn't be the first time that MS was wrong, but I don't think they are in this case.

Cheers and Regards

Posted Image


#16
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
These are your words that you posted

PROCESSOR_ARCHITECTURE will be equal to "x86" even though you are running a 64-bit OS on a 64-bit processor.


I still say you are wrong the below image show the PROCESSOR_ARCHITECTURE variable is returning AMD64 in
VBS and CMD Prompt.. From you posted it should be x86.
Attached File  Pro_Arch2.png   81.04KB   4 downloads


GunSmokingMan



#17
Falcor

Falcor

    Newbie

  • Member
  • 13 posts
  • Joined 28-February 13
  • OS:Windows 8 x64
  • Country: Country Flag
Thanks for all your help, people.

I am not too worried about how the code looks until after I have gotten everything working. Once that is taken care of I will clean it up. :thumbup

On to the next problem...

#18
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,540 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Detection Logic



The logic that I use from a program to detect whether the OS is 32bit or 64bit looks like this:

IF PROCESSOR_ARCHITECTURE == amd64 OR
PROCESSOR_ARCHITEW6432 == amd64 THEN
// OS is 64bit
ELSE
// OS is 32bit
END IF

Another way to test for the same thing is:

IF PROCESSOR_ARCHITECTURE == x86 AND
PROCESSOR_ARCHITEW6432 NOT DEFINED THEN
// OS is 32bit
ELSE
// OS is 64bit
END IF

Using that logic then the following should suffice:
ECHO=%PROCESSOR_ARCHITECTURE%' %PROCESSOR_ARCHITEW6432%'|FIND "64'">NUL 2>&1&&ECHO=[64bit]||ECHO=[x86]
Alternatively:
REG QUERY "HKLM\Hardware\Description\System\CentralProcessor\0" /v Identifier|FIND /I "x86"&&ECHO=[x86]||ECHO=[64bit]


#19
Geej

Geej

    Senior Member

  • Member
  • PipPipPipPip
  • 635 posts
  • Joined 01-January 08
  • OS:XP Pro x86
  • Country: Country Flag
inf detection logic

Just right-click ChkOSbitness.inf and "install"

[Version]
Signature=$Windows NT$

[DefaultInstall]
RegisterDLLs=Start.Register

[Start.Register]
11,,rundll32.exe,,,"advpack.dll,LaunchINFSection %1%\%infname%.inf,Install"

[Install.ntx86]
RunPostSetupCommands=echo86

[Install.ntamd64]
RunPostSetupCommands=echo64

[echo86]
cmd /c echo x86 section is called & pause

[echo64]
cmd /c echo x64 section is called & pause

[Strings]
infname=ChkOSbitness


#20
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
Win32_Processor class (Windows)

AddressWidth

Data type: uint16
Access type: Read-only

On a 32-bit operating system, the value is 32 and on a 64-bit operating system it is 64. This property is inherited from CIM_Processor.


So this would be the most effective way of finding out if the OS is x86 or x64
Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\CIMV2")
Dim Obj
  For Each Obj In Wmi.ExecQuery("SELECT * FROM Win32_Processor") 
   If Obj.AddressWidth = "64" Then
    MsgBox "64 Os Bit : " & Obj.AddressWidth
   Else
    MsgBox "32 Os Bit : " & Obj.AddressWidth
   End If 
  Next 



GunSmokingMan



#21
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,540 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

And this from the commandline / batch
WMIC CPU GET ADDRESSWIDTH /VALUE|FIND "=64">NUL 2>&1&&ECHO=[64bit]||ECHO=[x86]


#22
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag
GSM, I'm really not trying to argue with you.

These are your words that you posted


PROCESSOR_ARCHITECTURE will be equal to "x86" even though you are running a 64-bit OS on a 64-bit processor.


Yes I said that. But you seem to have missed the first part of the sentence:

But its value is important to check for since in that same unique circumstance that PROCESSOR_ARCHITEW6432 is defined, PROCESSOR_ARCHITECTURE will be equal to "x86" even though you are running a 64-bit OS on a 64-bit processor.


And again, I'm only quoting directly from Microsoft. My only explanation for your results is that the process that was running was a 64-bit process.

Cheers and Regards

Edited by bphlpt, 03 March 2013 - 01:56 PM.

Posted Image


#23
Geej

Geej

    Senior Member

  • Member
  • PipPipPipPip
  • 635 posts
  • Joined 01-January 08
  • OS:XP Pro x86
  • Country: Country Flag
PROCESSOR_ARCHITECTURE6432 comes into picture only when 32-bit application is running on x64 OS.
You might find this MSDN article useful.
It describes how x64 OS handles 32-bit applications.
Running 32-bit Applications (Windows)
Also read 'WOW64 Implementation Details'. It mentions PROCESSOR_ARCHITEW6432 environment variable.

In short, PROCESSOR_ARCHITECTURE6432 is not a variable to check your OS bitness.
PROCESSOR_ARCHITECTURE6432 is (as I see it) transparent to the user as it is how the operating system handles internally 32-bit program within a x64 os.

#24
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag
I give up. LOL I guess nobody reads or believes MS. :)

Cheers and Regards

Posted Image


#25
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,419 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
bphlpt

1:\ Posted code in wrong language, the poster wrote this in VBS
2:\ What you posted was no better than my original post.
3:\ Microsoft you keep saying that, but you have not provided any links to support what you claim.
4:\ Geej and I have posted links to support our claims.
5:\ Yzöwl provided a Cmd script, of VBS from what I read the most accurate way to get OS bit


GunSmokingMan






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users