09-08-2014 11:15 AM
I need to create a new temp directory and at the end of my program, I need to delete the temp files...pretty common thing to do. My problem is the permissions dont allow me to delete the files unless I set them first somehow. I want to know what the settings must be in the Set Permission.VI so I can then delete the files. How do I mechanize this?
09-08-2014 11:35 AM - edited 09-08-2014 11:38 AM
Try turning off the UAC. I've found that I get file permission errors if it is enabled.
Edit:
On setting permissions: http://zone.ni.com/reference/en-XX/help/371361K-01/glang/setting_permissions/
09-08-2014 11:41 AM
Thats interesting. Unfortunately in my case I cannot turn off the User Account Controls due to network security assurance issues. Thanks but are there any other ideas?
09-08-2014 11:41 AM
Thats interesting. Unfortunately in my case I cannot turn off the User Account Controls due to network security assurance issues. Thanks but are there any other ideas?
09-08-2014 11:48 AM
Do you still have an issue if you run the program as administrator? If this resolves the issue, you can follow these steps to have the executable request administrative privileges when it starts.
http://digital.ni.com/public.nsf/allkb/E06C1800F5AFCCBF86257236006C9F2A
09-08-2014 11:54 AM
So if I read this correct, in order to delete a file from a labview 2014 program that is stored in a windows temp directory I have to alter the windows 7 manifest xml file to allow this to occur? Is there no way to do this with the Get/Set Permissions VI tool or has microsoft made this too difficult? thanks
09-08-2014 12:55 PM
Are you having this issue in both the Development Environment and the Run Time Environment? The second solution that I linked is for executables only, and only makes it so that you don't have to turn off the UAC because it has administrative privilages. Anything that an administrator is able to do, the executable will now have permission to do. To test if this solution will work at all, just right click on the executable and select "Run as Administrator". If you are still having issues when the executable is running as administrator, the above solution will not work.
Try running this snippet and let me know what happens. All it does is create a file in the temp directory, read its permissions, then deletes the file. This runs on my computer with no error in the Development Environment and has the permissions of binary 110110110 (Decimal 438).
09-08-2014 01:00 PM
Yes I think that this is what I am more looking for. Here is the one that I got working which is similar to the one you posted.
09-08-2014 01:01 PM
I am working in the development environment now...but will eventaully build an exe for this program. Is there something I should be aware of here for exe's?
09-08-2014 01:16 PM
The transition from Development Environment to Executable is where the UAC permissions may become important. Adding or deleting files in the Program Files directory can be blocked by windows, and LabVIEW will return an error saying that it doesn't have permission to change these files. Turning off the UAC is the most simple solution, but having the Executable request administrative permission is a work around that I have found. There's probably a better way to do this, but I don't have much experience in this area.