This VI returns the path of the current VI or executable as well its installation directory
If you have ever built a VI that uses the native Current VI's Path function, then you have most likely had to deal with unexpected behavior after you build your VI into an executable. The VI works great in the development environment, but when you build it and run it as an executable, you may see any number of problems which may include, but not be limited to errors when performing File I/O.
The Current VI's Path (VI or exe) VI is a drop-in replacement for the native Current VI's Path function and it will return the path of the code running in the development environment or as an executable!
Steps to Implement or Execute Code
Run the included example VI and executable to see how you can use this functionality in your applications.
LabVIEW 2012 (or compatible)
Additional Information or References
The Current VI's Path (VI or exe) VI gets the path to the VI that called it and searches that path for ".exe". If ".exe" is found in the path, then the Current VI's Path (VI or exe) VI strips the path twice to obtain the executable's installation directory. If ".exe" is not found, then the Current VI's Path (VI or exe) VI strips the path once to obtain the VI's installation directory.
In either case, the Current VI's Path (VI or exe) VI returns the VI or executable installation directory and the Full Path to the VI or executable. You can use this information in your application to easily access sub folders of the VI's or executable's installation directory by using the Build Path function to append the sub directory's name to the VI's or executable’s installation path returned by the Current VI's Path (VI or exe) VI.
**This document has been updated to meet the current required format for the NI Code Exchange.**