Reset File Archive Attribute for all files

Discussion in 'Scripting' started by adric, Feb 22, 2023.

  1. adric

    adric MDL Expert

    Jul 30, 2009
    1,406
    1,544
    60
    #1 adric, Feb 22, 2023
    Last edited: Feb 22, 2023
    Is there a way to reset the file archive attribute for all files including those that have an attribute of hidden?
    I get errors on the hidden files trying different ways. All hidden files that have the archive attribute set (+a) don't get reset. Even when using nsudo and powerrun. I want to keep the state of files that are hidden or system. Only the archive flag should be reset.
     
  2. Dolmatov

    Dolmatov MDL Addicted

    Aug 16, 2017
    560
    492
    30
    Details?

    Judging by the mention of utilities, you are using Windows.
    Have you tried running the command prompt with System and/or TrustedInstaller rights? Then run the attrib command.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. adric

    adric MDL Expert

    Jul 30, 2009
    1,406
    1,544
    60
    #3 adric, Feb 22, 2023
    Last edited: Feb 23, 2023
    (OP)
    I mentioned nsudo and powerrun in the OP which will run with all rights. I.e details:
    Code:
     \NSudo\x64\NSudoLC.exe -U:T -P:E cmd /k attrib -a c:\bootmgr
    .vbs and powershell don't reset the archive bit either for files flagged hidden or system. You can reset the archive flag if you use -h -s -a, but that has an undesirable effect.