Example Code

Determine if the Windows Environment is 32-bit or 64-bit Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

 

Overview

This VI uses parses the string output of the System Exec VI to determine if the Windows Environment is 32-bit or 64-bit.

 

Description

The System Exec VI is called with the command "wmic os get os architecture", which returns:

-------------------------------------------------------

Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\>wmic os get osarchitecture

OSArchitecture

64-bit        

C:\>

-------------------------------------------------------

This string output is then parsed to return the "32" or "64" and highlight an appropriate LED on the front panel.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI.
  2. Check the lights to see if it is 32/64 bit OS

 

Additional Information or References

 VI Snippeto of Block Diagram

sni.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange. **

 

Rick C.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
CMarco
Member
Member
on

The above snippet is good, but it fails for example for OS win 10 that has a different reply to command "wmic os get os architecture". I suggest this more general implementation with Regular Expression:

vi_32_64_bit.jpg