From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I detect OS from LabVIEW?

I'm trying to write a VI which will run up an external application in LabVIEW... the VI can be run on 2 seperate OSes (windows or linux), I'm just wondering is there a smart way (or some built-in LabVIEW function or whatever) for my VI to automatically detect the OS it's being run under & launch the corresponding version of the external application?

Cheers,

M.J.
0 Kudos
Message 1 of 5
(4,788 Views)
Place a property node (in the Application Control palette) on the diagram. Click the name and select Operating System>>Name.

___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(4,783 Views)

Here is a chart to explain the results.

http://digital.ni.com/public.nsf/allkb/CA447A83428AC4A486256F39004B7F32

You can also read registry values and environment variables. I have some examples at work, but I'm on vacation this week.

0 Kudos
Message 3 of 5
(4,779 Views)
Here is a vi to read the windows product name from the registry.
0 Kudos
Message 4 of 5
(4,766 Views)

The .vi from unclebump doesn't work on Windows 10 Pro (at least for my login).  Easy to fix:  add "KEY_READ" as the access type.

 

I'm having similar issues with other apps accessing the registry, too.  I guess it was a "security improvement".

 

Another method of getting the OS rev:  Use a Property Node, select class to "VI Server/Application", and pick "Operating System/Version Number".  The text is different, so not a direct replacement.  "Operating System/Detailed Name" is the same as the registry method (at least on Windows 10 Pro).  I didn't test outside Windows, but expect it to work.

 

[Of course, we can never trust new OS updates to behave exactly the same, so be careful to test.]

 

___________________
CLD, CPI; User since rev 8.6.
0 Kudos
Message 5 of 5
(3,217 Views)