LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW and File/Folder Permissions Issues in Windows 10

It seems like this should be a really common issue, but I've searched the forums and googled the universe and haven't yet found a good explanation or solution.

I have several applications that I am currently upgrading from older versions of LabVIEW and Windows to LabVIEW 2016 or 2017 and Windows 10. The way these programs were written included opening, creating, reading, writing, and deleting files in various locations, including "C:\Program Files\myprogram". E.g. they often write or delete config files or other files in their own "Program Files\..." directory.

When moved to Windows 10, this causes permission errors. Even though the user running LabVIEW is an Administrator, the programs only work when you run LabVIEW using the right-click "Run as Administrator" setting. This is not a good solution, since, not only is it inelegant, but the dialog it throws means the process can't be automated with no user interaction.

I think another solution is to mess with permissions on the various folders. I suppose this could probably be automated as part of an installation routine, but I was hoping there was a more direct solution.

Am I missing anything here? Is there any "easy" way to make these kinds of programs work in Windows 10?

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
Message 1 of 11
(8,652 Views)

I hope I'm not stating the obvious, but can the files be saved in a user accessible folder instead (using Get System Directory.vi)? This would be the most future-proof (and secure) option.

 

Otherwise UAC Virtualization should handle what you're trying to do. See also: https://stackoverflow.com/questions/8852967/force-an-existing-application-to-always-run-with-uac-vir...




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 2 of 11
(8,607 Views)

Yeah, rewriting it to use a different folder structure is definitely a possibility, but it wasn't the intention. If that's what it takes, they'll have to bite the bullet and do it. But there are several files in several places, so it's not trivial.

Thanks for the other ideas. I've got to say, though, that I was bit bad by UAC Virtualization back in Vista days, and have been more than glad to see it fade into the background. Not really sure I want to go back down that road. But I appreciate the references.

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 3 of 11
(8,603 Views)

I had this problem too some years ago, and I choose to move all data to external folders. However, in the Source File Settings category of the Installer build specifications, there is an Unlock checkbox available for either single files or whole directories. I never tried this, however in my understanding the Unlock feature will allow you to change the selected files or directory contents after the installation.

LabVIEW itself is using this feature; for example, you can freely edit LabVIEW.ini.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 4 of 11
(8,588 Views)

Thanks! This is exactly the kind of thing I was hoping was out there. (The power of the forums!)

This sounds like it would work... for built applications. I failed to mention that in one of my cases, we are building an .exe. In another, we are using LabVIEW as source. Another issue with this is that it does not allow you to unlock the predefined destinations. So a sub-folder of the \Program Files\... might work, but probably not the main installation folder itself. I don't think that should be an issue in my case. Also, the fact that the installer can do this gives a clue about how to solve it for the source code as well. May have to do it manually, but it should be possible just to tweak the folder permissions.

Thanks again,

      Dave

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 5 of 11
(8,568 Views)

One other partial solution: set UAC to its minimum level. This still requires that LabVIEW be Run as Administrator (which can be set up in the Compatibility tab of the Properties of the LabVIEW.exe file.) But at least with UAC turned down, you don't have to click on the dialog box every time LV is launched. Obviously, this isn't a good partial solution for computers where you don't want to turn UAC down!

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 6 of 11
(8,502 Views)

Hi Dave,

 

even though you seem to look for "quick and (maybe not so) dirty" solutions I would still recommend to follow the Microsoft suggestion of using folders like %LocalAppData% or %CommonProgramFiles%.

LabVIEW has the GetSystemDirectory function to find all these path dynamically…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 11
(8,498 Views)

That's definitely the preferred solution. In one case, I can work on making that happen over time. In another, it's the client's call as to whether we can rewrite the app to that level.

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 8 of 11
(8,494 Views)

Hi, I wanted to follow up on this as I'm having the same issue now.  Went from running LV8.6 on XP, to LV2018 on W10.  I've tried messing with the permissions for the C drive but nothing seems to work.  I can't create or write to a file that is located at the root C:.  What did you end up using as a solution David?

0 Kudos
Message 9 of 11
(7,615 Views)

Hi M.,

 

with a recent Windows OS (more recent than that old WinXP) you should not create files in the root folder of your system drive. (This is a Windows recommendation, so read MSDN for more information.)

 

You can easily create files in your local user account (C:\users\username)…

Best regards,
GerdW


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