How can I tell if I am running 64 or 32 bit OS while running QTP Test?
Question ID: 104589
3
0

I have several test machines with different OS’s (XP,Win 7, etc) and architecture (32/64). Is there a way to detect if the architecture is 32 or 64 bit while running test so I can make sure the path to the application under test is correct?

Marked as spam
Posted by (Questions: 2, Answers: 98)
Asked on September 10, 2012 12:47 pm
52 views
Answers (1)
8
Private answer

I use the function getbit that I have made below. Also as a bonus I have provide the function GetOS to show how to use it.



Function GetOS()
	Set objWMIService = GetObject(''winmgmts:{impersonationLevel=impersonate}!\.rootcimv2'')
	Set list = objWMIService.ExecQuery(''Select * from Win32_OperatingSystem'')
	For each obj in list
		GetOS = obj.Caption & '' Service Pack '' & obj.ServicePackMajorVersion & ''.'' & obj.ServicePackMinorVersion
		GetOS = GetOS & chr(32) & GetBit() &  chr(32) & ''bit''
	next
end function


Function GetBit()
	set Reg = CreateObject(''WScript.Shell'')
	If Reg.RegRead(''HKLMSYSTEMCurrentControlSetControlSession ManagerEnvironmentPROCESSOR_ARCHITECTURE'') = ''x86'' then
		GetBit = ''32''
	Else
		GetBit =''64''
	End if
End Function

msgbox getbit()
msgbox GetOS
Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on September 10, 2012 12:49 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top