LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the file path for an exe?

I have vi's which read a ini file from a specified directory.When an executable is created,i would like the application to read the ini file from the data folder that's created during 'Build Application' (i.e not atleast from the ini filepath which was given as constant previously in the vi's).Pls do help me out on this.Thanks in advance.
0 Kudos
Message 1 of 6
(4,858 Views)
Hi,
Normally all .ini files and other data files which are added during the building of a exe are stored in a folder which is folder where the exe is installed/data.for eg if you install your exe in program files then it shall be C:/ProgramFiles/your exe/data.so what you have to do in your program is you must build the path by taking the vi "CURRENT VI's PATH.vi" and add a /data to this path ,so that when you build the exe ,whereever you install your exe it will automatically take up the files you have added in the building.
hope it helps else reply back ,shall post a example for you.
cheers
vicky
0 Kudos
Message 2 of 6
(4,856 Views)
Hi,
Yes,i did add the same way.Used Current vi path then stripped of the vi name and added /data/Config.ini to the path.It works fine,
but when an exe is created it doesn't read from the directory,throws out error.I'll just let u know the directory specification with an example,if there's a mistake...
Example:
1)Assume first.vi residing in C:\NI which reads a Config.ini file from C:\NI\data\Config.ini
2)The ini file is read,by reading the current vi path then stripping the vi name and added data\Config.ini in the vi.
3)It works fine when it's run,not a problem.
4)This vi is converted to an exe(by adding Config.ini in Add Support file tab) during the build.The exe is stored at C:\NI\EXE
5)After exe creation,a folder is also created at C:\NI\EXE\data with Config.ini file in it.
6)When this vi is run,it throws out an error guess doesn't read the ini file path correctly.
If any of the above steps i mentioned was wrong,pls help me correct it out.Thanks a lot.
0 Kudos
Message 3 of 6
(4,854 Views)
hi,
what steps you have told is perfect,could you just post the error your getting,may be it is for some other reason.post a screen shot of the error message if your .llb is too big.
cheers
vicky
0 Kudos
Message 4 of 6
(4,850 Views)
Hi,
I have attached the error message.But it's clear that it couldn't read the file path.In the picture,u could see the data folder which has Config.ini file.Maybe when we read current vi path,rather the exe doesn't return it properly.thanks.
0 Kudos
Message 5 of 6
(4,846 Views)
When the VI is built into an executable, the EXE is actually an LLB, which is the directory the VI is in. So, to get the directory the EXE is in, you need to use Strip Path after getting the VI path.
Also, please don't post BMP files, they're too big. Use JPG, GIF or PNG instead.

___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(4,844 Views)