LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set Permissions for file deletion

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? 

0 Kudos
Message 1 of 12
(3,510 Views)

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/

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

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?

0 Kudos
Message 3 of 12
(3,494 Views)

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?

0 Kudos
Message 4 of 12
(3,494 Views)

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

0 Kudos
Message 5 of 12
(3,487 Views)

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

0 Kudos
Message 6 of 12
(3,483 Views)

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). 

Create and Destroy File.png

0 Kudos
Message 7 of 12
(3,457 Views)

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.

0 Kudos
Message 8 of 12
(3,452 Views)

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?

0 Kudos
Message 9 of 12
(3,450 Views)

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. 

0 Kudos
Message 10 of 12
(3,446 Views)