unsetting read only flag on folder does not stick

Page 1 of 2 12 LastLast

  1. Posts : 187
    Windows 7
       #1

    unsetting read only flag on folder does not stick


    A program I am running needs to access files in its folder but cannot do so because they are read only. The folder is in my Program Files (x86) folder.

    When I go to the program folder and check its properties I find that it is read only. Even though I unselect the read only flag, click on Apply, say yes to all the files in the folder, and approve the admin permission to proceed, and then click on OK, when I relook at it my change to unselect read only did not stick.

    What am I doing wrong?

    Thanks
      My Computer


  2. Posts : 187
    Windows 7
    Thread Starter
       #2

    Thank you for helping.

    Tried it but the folder remains read only. Weird. App works with "run as admin" but that does not explain why the attribute will not change. Is this related to UAC?

    Thanks again.

    Edit: I also checked and I am the owner of that folder and gave myself full control.
    Last edited by Anderson2; 26 Jan 2010 at 16:28. Reason: added content
      My Computer


  3. Posts : 72,049
    64-bit Windows 11 Pro for Workstations
       #3

    It sounds like a privilege level issue with the program since it works with "Run as administrator". Use OPTION THREE in the tutorial below to set the program to always "Run as administrator".

    Run as Administrator
      My Computer


  4. Posts : 5,642
    Windows 10 Pro (x64)
       #4

    Folders do not have Readonly, the checkbox in the properties only effects files.
    The problem you are facing is Program Files is a protected directory and unauthorized writting to this directory without running as Admin is redirected to:
    Code:
    C:\Users\[username]\AppData\Local\VirtualStore
    An application, however, should not be writing to Program Files.
      My Computer


  5. Posts : 187
    Windows 7
    Thread Starter
       #5

    Thank you all. I appreciate the help.
      My Computer


  6. Posts : 1,261
    Windows 7 Professional 32-bit SP1
       #6

    Actually, the reason why you believe that the "Read Only" attribute change does not stick, is that when displayed for folders, the checkbox is usually filled in, which is a visual cue that the files within the folder may either be readonly or not, or a combination of the two states.

    If the check box is clear, then the readonly attribute is off. If a checkmark is visible, then the attribute is set.

    Also, what you should be doing is looking to update your program to a Vista/Windows 7 compatible version. NO program, regardless of it function, should be saving configuration or user data in a sub-folder of "Program Files" or "Program Files (x86)". When an application does this, it's a sign of a lazy (or worse) programmer.
      My Computer


  7. Posts : 3
    Windows 7 Home Premium
       #7

    Hi Dzomlija,

    I'm developing programs for WinXP but now I need to create an application for Windows 7.
    After reading above posts and my own experiences, writing and deleting files under Program Files sub-folder has issues.
    And you also mention that we should not write under Program Files sub-folder.
    However, if we must choose another location except Program Files, I can't think of another location in win 7 folder structures.

    Can you suggest me where should I save then?? (I don't have any offence. I just need a guide on that cuz i'm new to win7 and its folder structures)

    or should I save my temp files under the location mentioned by logicearth?
    C:\Users\[username]\AppData\Local\VirtualStore

    Thanks.
      My Computer


  8. Posts : 2,737
    Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
       #8

    Always save to "My Documents" for Windows XP and "Documents" for Windows 7. Temp files should always be saved to: %temp% = (C:\Users\<username>\AppData\Local\Temp) in Windows 7. It is universal so it will work in Windows XP or Windows 7
      My Computer


  9. Posts : 5,642
    Windows 10 Pro (x64)
       #9

    scsfdev said:
    Can you suggest me where should I save then?? (I don't have any offence. I just need a guide on that cuz i'm new to win7 and its folder structures)
    The Old New Thing : What's the difference between My Documents and Application Data?

    In Windows Vista and Seven, Application Data is C:\Users\[username]\AppData\Roaming
    While Local Settings is C:\Users\[username]\AppData\Local
      My Computer


  10. Posts : 748
    Vista and now 7 in 32 and 64 bit.
       #10

    All the folders in Windows 7, as in Vista and XP, are read only. You cannot change this attribute. You can untick the box, as suggested, but, even on an empty folder, if you reopen the properties, you will find it is read only again. Windows Explorer ignores this attribute.
    You can read up on the function here:
    You cannot view or change the Read-only or the System attributes of folders in Windows Server 2003, in Windows XP, in Windows Vista or in Windows 7
    Fwiw. Applications often write to their own folder in Program files.
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 06:55.
Find Us