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: 

Relative Path to Files in a build .EXE

I'd like to add a log.txt file into my LabView projects which eventually get built up into a LabView application (.EXE). I then use that built application to distribute to multiple computers on our manufacturing floor. Currently when I build my application I have to hard code the path where I want the file which changes for every computer I put it on.

I'd like the log.txt file to always be created in the folder of my .EXE that I put on the computer. That way I always no where it is and I don't get a path error when this built up .EXE changes computers. How would I go about creating a relative path in my vi that gets built into the .EXE?

0 Kudos
Message 1 of 3
(1,519 Views)

Look in the File Constants >> File I/O palette.  There is a function called Get System Directory.  You can choose from many different paths that are based on the OS.

 

There are primitives in there that will return things like the Application Directory.

0 Kudos
Message 2 of 3
(1,502 Views)

@bmernax30 wrote:

I'd like the log.txt file to always be created in the folder of my .EXE that I put on the computer. That way I always no where it is and I don't get a path error when this built up .EXE changes computers. How would I go about creating a relative path in my vi that gets built into the .EXE?


Use the Application Directory function.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 3
(1,454 Views)