Instruct LabVIEW to Launch a Particular VI Automatically

Updated Oct 25, 2020

Environment

Operating System

  • Windows
  • Mac OS X

I have a VI I created in LabVIEW, and now I would like to have LabVIEW open and run the VI automatically when LabVIEW is launched. What options do I have to do this?

By default, when LabVIEW launches, it creates a new untitled VI. You might want your application to launch a particular VI automatically. You also can set the VI to run when loaded, so launching LabVIEW not only opens your VI but also runs it. Set the appropriate Execution options in File >> VI Properties to make a VI run when opened. If you specify a library (.llb) to be opened when your application launches, it opens all top-level VIs. Select Tools >> Edit VI Library to mark VIs as Top Level. When you launch LabVIEW, if the library has no top-level VIs a file dialog box prompts the user to select a VI in the .llb.

Refer to the following sections for more information about launching a particular VI on your platform.

Windows

Create a shortcut for LabVIEW by right-clicking the LabVIEW icon and selecting Create Shortcut. Right-click the LabVIEW shortcut and select Properties. In the Target field, change the path name to the path of your VI. For example, to make LabVIEW load test.vi automatically, set Target to:
"C:\Program Files\National Instruments\LabVIEW 8.6\LabVIEW.exe" test.vi
If test.vi is inside a library called test.llb, enter:
"C:\Program Files\National Instruments\LabVIEW\LabVIEW.exe" test.llb\test.vi
It might be necessary to specify the full path to the VI. Use the following syntax if you want to launch a VI from the command line (Start >> Run): 
C:\Program Files\National Instruments\LabVIEW\LabVIEW.exe path
where path is a path to the VI relative to the LabVIEW directory.

For example, to launch the Readme.vi inside the C:\Program Files\National Instruments\LabVIEW\examples directory, enter:
C:\Program Files\National Instruments\LabVIEW\examples\readme.vi
If the VI is located in a different path, you must specify the full path to the VI, for example: 
C:\Program Files\National Instruments\LabVIEW\LabVIEW.exe C:\app\mycool.vi
If a directory in the path contains spaces, you must enclose the path in quotation marks, for example:
C:\Program Files\National Instruments\LabVIEW\LabVIEW.exe "C:\cool app\mycool.vi"


If the VI is in an LLB, you can do one of the following:

  1. Specify the full path in quotation marks:
C:\Program Files\National Instruments\LabVIEW\LabVIEW.exe "C:\app\eagle.llb\mycool.vi"
  1. Select File >> VI Properties, select Execution from the pull-down menu, and place a checkmark in Run When Opened. Then, select Tools >> Edit VI Library and mark the VI as Top Level. In this case, you only need to specify the path to the .llb:
C:\Program Files\National Instruments\LabVIEW\LabVIEW.exe "C:\app\eagle.llb"
Macintosh

You cannot instruct LabVIEW to launch a particular VI automatically. However, you can launch a VI by double-clicking its icon in the Finder. If you have multiple copies of LabVIEW installed on your machine, the Finder determines which copy launches when you double-click the VI; you cannot control which copy is launched. For example, the Finder might launch the Run-Time System if both the Run-Time System and Full Development System are installed. If you are running System 7 or later, you can use Drag & Drop to launch one or more VIs or VI libraries.

UNIX

LabVIEW responds to command-line options to launch a particular VI when opened. Therefore, to launch the Test VI, you can type:
labview /usr/home/test.vi
 Or
labview /usr/home/test.llb/test.vi
Which of the above two you choose will depend on the correct path to your VI.  You can also use a simple script to make a command that launches LabVIEW with a particular VI.