How to remove protected files from within Windows.

Discussion in 'Troubleshooting Help' started by self_slaughter, Mar 14, 2019 at 7:15 PM.

  1. self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,407
    Location:
    4165
    So, steam proton has left some protected files on my ntfs hard drive. com1,com2 etc...

    Is there anyway to delete these from within Windows?
    I know I could just delete them from Linux, but that's too easy. :p

    Even with some trickery in the command prompt, they don't seem to want to go away.

    upload_2019-3-14_18-10-9.png
     
  2. PsydFX

    PsydFX Member

    Joined:
    Jan 1, 2011
    Messages:
    3,338
    What does it say when you try and delete them? Are they being held open?

    You can also try PowerShell as well:
    remove-item -force
     
    Last edited: Mar 14, 2019 at 8:13 PM
  3. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,407
    Location:
    4165
    Yeah, I tried that and the \\?\ trick I saw mentioned on other sites to remove protected files using such names, but no luck so far.

    Windows just steps in with some jedi shit. "This is not the file you are looking for..." lol

    upload_2019-3-14_19-19-29.png

    Edit: cygwin64 is able to remove them without windows interfering. But there must be a way to do it natively?
     
    Last edited: Mar 14, 2019 at 8:36 PM
    Wozzernux likes this.
  4. Lost Property

    Lost Property Member

    Joined:
    Aug 30, 2013
    Messages:
    2,282
    Not sure if it gets rid of those files but there is a program called "unlocker" that gets rid of files and folders explorer says do not exist but can be clearly seen to exist.
    You run it, select the file/folder then choose whether to delete, rename, ignore.
    At times it says it can't delete and will delete on next reboot.
    In cases like that I choose rename, then rerun the program and choose delete and it's usually gone.
     
  5. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,407
    Location:
    4165
    yeah even rename won't work. Windows steps in and just says the file doesn't exist.

    upload_2019-3-14_19-39-42.png
     
  6. Lost Property

    Lost Property Member

    Joined:
    Aug 30, 2013
    Messages:
    2,282
    Unlocker gives the choice to rename, delete or ignore. On files/folders that it says will be fixed at next reboot I used Unlocker to rename then run it again and it usually deletes without rebooting.
     
  7. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,407
    Location:
    4165
    yeah, still just trying to see if there is a "native" way of removing them.

    cygwin removes them easily enough, but thats not the point. lol

    upload_2019-3-14_19-51-10.png
     
  8. PsydFX

    PsydFX Member

    Joined:
    Jan 1, 2011
    Messages:
    3,338
    Are there two paths with those file?
     
  9. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,407
    Location:
    4165
    I have about 6 copies of those files.
    One was in steams proton folder itself, and each game I've ran via proton has a copy in its files as well.

    Even just trying to delete the entire "BROKEN" folder fails when it hits any of those files, as windows does its thing like with any protected name like com/lpt/nul etc. and says it doesn't exist.

    It just has me interested, as you would think there has to be some way of removing them naturally.

    upload_2019-3-14_19-59-54.png
     
  10. PsydFX

    PsydFX Member

    Joined:
    Jan 1, 2011
    Messages:
    3,338
    They’re intentionally protected so you can’t delete them. I’ve just tested it though, and I’ve been able to create and delete using the del \\.\d:\path\com1 method
     
    Last edited: Mar 14, 2019 at 9:25 PM
  11. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,407
    Location:
    4165
    hmmm, odd that I couldn't remove them with that method.

    Unless its something tricky to do with them being real symbolic links and not just files with a protected name.

    Eh, I think I've burnt enough time trying to find a native solution. At least cygwin has no dramas getting rid of them.

    Cheers for the help. :)
     
  12. Myne_h

    Myne_h Member

    Joined:
    Feb 27, 2002
    Messages:
    8,236
    What are the permissions?

    I'd usually take ownership, remove all permissions from all users, reboot, retake ownership, delete

    Works well with viruses and other malware.
     
  13. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,407
    Location:
    4165
    It's not so much a permission thing as a "protected" windows filename.
    com1,com2,lpt1,lpt2,nul etc. are all names that windows generally wont let you use, modify or delete.

    Just try rename a file to "nul" and see what happens. Windows will tell you that its "invalid".

    I've given up trying and just used cygwin to remove them without hassle. *shrugs*
     
  14. philquad

    philquad Member

    Joined:
    Jan 22, 2004
    Messages:
    859
    Location:
    nelson bay

Share This Page