LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I set file permissions

I need to rename a file but am getting a file permission error. What can I do?
0 Kudos
Message 1 of 12
(12,707 Views)
See File IO > Advanced File Functions to get/set permission properties.
Hope that helps.
0 Kudos
Message 2 of 12
(12,703 Views)
Hi Percy and Vikas,

the "get/set permissions" work on owner/group file settings in an Unix-style filesystem! Those settings aren't supported by Windows (as is written in the context help for those functions).
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 12
(12,697 Views)

Thanks GerdW for the info.

Percy, if you are on the Windows platform, you could use the DOS command ATTRIB to set or remove permissions. Type "attrib/?" under DOS to see the usage.

Also see the attached code. Replace the "testfile.txt" to your file name and give an appropriate working directory. Hope this helps.

Regs,

Vikas

0 Kudos
Message 4 of 12
(12,687 Views)
You can still use the Set/Get Persmissions in Windows to determine/set whether the file is read-only.

You cannot use it to change Windows Security Settings for a file.
0 Kudos
Message 5 of 12
(12,684 Views)
Hi PercyH,

You can check if your file is read only by right clicking on the VI and clicking on properties. On the general tab, ensure that the read-only box is not checked. What exactly does the error say?



Warm regards,
Karunya R
National Instruments
Applications Engineer
0 Kudos
Message 6 of 12
(12,641 Views)
Thank you all. Setting the permisions via the command line worked perfectly.Smiley Happy
0 Kudos
Message 7 of 12
(12,627 Views)

I have run into a somewhat similar problem myself:

 

We run a number of windows-based  multi-user systems and Labview default file permission settings does not allow one user to modify files created by another user.

 

I tried a solution similar to the above, although using a more advanced command line tool "ICACLS" instead of "attrib" to give a full access rights to everyone after particular file is created by Labview.

 

What's bothering me is that every time a command line call is made, a shell window pops up for a split second on top of the screen.

 

Is there any way to suppress this window from popping up or perhaps use a different way of calling windows functions to avoid this behavior?

 

 

 

 

0 Kudos
Message 8 of 12
(12,175 Views)

Hi Fedor,

 

Assuming you are still using the System Exec.vi to make the call, wire a TRUE boolean to the run minimised? input.  That should solve your problem.

 

- Vikas

0 Kudos
Message 9 of 12
(12,161 Views)

I realise this is quite an old thread but I still couldn't find an elegant solution in the LabVIEW forum.

 

Have a look here for how to do it in LabVIEW.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 10 of 12
(10,454 Views)