Example Code

Changing Code Execution Based On Operating System Target

Code and Documents

Attachment

Overview:
Detects in which OS the application is running on.

Description:
This code makes usage of the VI server to detect the Name of OS and then, select how to execute any specific code. very similar to the pre-processor define commands found in C/C++ and will allow a single project to run over multiple OS targets without requiring a re-code.

Requirements:
LabVIEW 2012 (or compatible).

Steps to Implement or Execute Code:
1. Run the VI
2. Check the Command console indicator for the result of the ipconfig command.

Additional Information or References:
This code will only work for Windows. For any other OS further code will be required.

Pre-Processor Macro Example - LV 2012 NI Verified.png
"**This document has been updated to meet the current required format for the NI Code Exchange.**".

Applications Engineer

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

Comments
surfnska
Member
Member
on

Could you upload this as an LV 8.6 file?

rsw
NI Employee (retired)
on

Please find attached LV 8.6 version


Applications Engineer
surfnska
Member
Member
on

thank you