05-26-2021 01:48 PM
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.
05-26-2021 01:58 PM - edited 05-26-2021 01:59 PM
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…
05-26-2021 01:58 PM
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
05-26-2021 02:21 PM
OK, So can I create a new path in the c:\ drive? Say I use C:\Testdata\... Will that work?? Thanks!
05-26-2021 02:33 PM - edited 05-26-2021 02:41 PM
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…
05-26-2021 03:12 PM
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.
05-26-2021 04:58 PM
@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.
05-28-2021 12:05 AM
05-28-2021 05:51 AM
@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.
06-03-2021 11:42 AM
So I ended up writing to a directory in the user profile with no issues. Thanks for all your help!!