Getting Operating System Information

Applies to TestComplete 15.69, last modified on November 13, 2024

TestComplete lets you check the Windows version, bitness and other information in your automated tests. This way, you can, for example, run some operations only on a specific Windows version.

To get Windows information, use the following objects:

  • Sys.OSInfo - contains the Windows version, edition, bitness, service packs and other information.

  • aqEnvironment - contains environment variables, locale info and Windows build numbers.

The example below checks Windows bitness (32-bit or 64-bit):

JavaScript, JScript

function Test()
{
  if (Sys.OSInfo.Windows64bit)
    Log.Message("You have 64-bit Windows.");
  else
    Log.Message("You have 32-bit Windows.");
}

Python

def Test():
  if Sys.OSInfo.Windows64bit:
    Log.Message("You have 64-bit Windows.")
  else:
    Log.Message("You have 32-bit Windows.")

VBScript

Sub Test
  If Sys.OSInfo.Windows64bit Then
    Log.Message "You have 64-bit Windows."
  Else
    Log.Message "You have 32-bit Windows."
  End If
End Sub

DelphiScript

procedure Test;
begin
  if Sys.OSInfo.Windows64bit then
    Log.Message('You have 64-bit Windows.')
  else
    Log.Message('You have 32-bit Windows.');
end;

C++Script, C#Script

function Test()
{
  if (Sys["OSInfo"]["Windows64bit"])
    Log["Message"]("You have 64-bit Windows.")
  else
    Log["Message"]("You have 32-bit Windows.")
}

See Also

aqEnvironment Object
OSInfo Object
Running Tests on Multiple Operating Systems

Highlight search results