LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 8 file error only in the executable

I have LabVIEW project that runs perfectly when you run it in the development environment.  When I create the executable, I install it in C:\Program Files\...  I write to a sub directory in that path when I create my data file, but it will not create the file when I run the .EXE.  Is this a Windows error?  I keep getting ERROR 8 file permissions error.  The program should create a new data file with a different path every time it runs.  The data file does not even exist, so it can't already be open.  All I am running is just the .EXE.  Nothing is running in the background.  Any advice would be great.  I feel like I tried everything.

 

Thanks.

0 Kudos
Message 1 of 10
(2,207 Views)

Hi fan,

 


@Flyerfan88 wrote:

I have LabVIEW project that runs perfectly when you run it in the development environment.  When I create the executable, I install it in C:\Program Files\...  I write to a sub directory in that path when I create my data file, but it will not create the file when I run the .EXE.  Is this a Windows error?  I keep getting ERROR 8 file permissions error.


Usually programs running with standard user permissions are not allowed to create new files in the "C:\program files\" folder! You need admin rights to be allowed for such operations…

 

The solution is to save the file(s) in a different folder. Microsoft recommends to use folders like %appdata% or %localappdata%. In such folders users generally have write permissions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(2,191 Views)

Hi,

 

that's a Windows precaution nowadays, an executable usually is not allowed to change or create files inside the Program Files subdirectories.

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 3 of 10
(2,190 Views)

OK, So can I create a new path in the c:\ drive?  Say I use C:\Testdata\...  Will that work??  Thanks!

0 Kudos
Message 4 of 10
(2,175 Views)

Hi fan,

 


@Flyerfan88 wrote:

OK, So can I create a new path in the c:\ drive?  Say I use C:\Testdata\...  Will that work??  Thanks!


When you can create such a folder using the Windows Explorer then your executable can do that, too.

 

That being said:

I don't like programs, which create folders right below the C:\ root to store "work data".

IMHO programs should work as proposed by Microsoft guidelines: use user-related folders or ask the user where to store datafiles!

 

This is how my C: drive looks like:

Apart from "Toshiba" and "Intel" (it's a Toshiba laptop with an Intel graphics card) only NIFPGA uses its own folder right under C:\. All other tools store their data in folders under "Benutzer" (aka "users") or similar folders…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(2,167 Views)

If this applicatrion can be used by multiple people and they need to share data between them I would place the data in the public folders or in the ProgramData folder. If you place it in ProgramData, you should also create a subfolder there either named for the application, project or company.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 10
(2,155 Views)

@Mark_Yedinak wrote:

If this applicatrion can be used by multiple people and they need to share data between them I would place the data in the public folders or in the ProgramData folder. If you place it in ProgramData, you should also create a subfolder there either named for the application, project or company.


Yes that's what you should do, but note that ProgramData is hidden by default, so if anyone ever needs to browse to it you either need to unhide the folder or tell all possible users how to view hidden folders, or set up a shortcut somewhere everyone can get to it, like on the public desktop.

0 Kudos
Message 7 of 10
(2,109 Views)

There's a VI for this in the file constants palette:

thols_0-1622178265418.png

 

Certified LabVIEW Architect
0 Kudos
Message 8 of 10
(2,038 Views)

@Kyle97330 wrote:

@Mark_Yedinak wrote:

If this applicatrion can be used by multiple people and they need to share data between them I would place the data in the public folders or in the ProgramData folder. If you place it in ProgramData, you should also create a subfolder there either named for the application, project or company.


Yes that's what you should do, but note that ProgramData is hidden by default, so if anyone ever needs to browse to it you either need to unhide the folder or tell all possible users how to view hidden folders, or set up a shortcut somewhere everyone can get to it, like on the public desktop.


Actually, when you want to store files that a user should be able to find himself, you are not supposed to store them in the AppData folder. AppData is specifically for files such as configuration files, internal dynamic data files, etc. that a normal user should never have to touch himself directly.

 

Files meant to be accessed by your users should normally be stored in the Public Document (if any logged in user on the machine should have access to it) or User Document (if the files are user specific) folder, and its extra nice if your application allows to set the root of this in your Configuration screen.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 9 of 10
(2,011 Views)

So I ended up writing to a directory in the user profile with no issues.  Thanks for all your help!!

0 Kudos
Message 10 of 10
(1,960 Views)