How to remove protected files from within Windows.

Discussion in 'Troubleshooting Help' started by self_slaughter, Mar 14, 2019.

  1. self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,434
    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,548
    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
  3. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,434
    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
    Wozzernux likes this.
  4. Lost Property

    Lost Property Member

    Joined:
    Aug 30, 2013
    Messages:
    2,295
    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,434
    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,295
    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,434
    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,548
    Are there two paths with those file?
     
  9. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,434
    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,548
    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
  11. OP
    OP
    self_slaughter

    self_slaughter Member

    Joined:
    Dec 12, 2010
    Messages:
    1,434
    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,357
    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,434
    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:
    886
    Location:
    nelson bay
  15. FOTW

    FOTW Member

    Joined:
    Jul 20, 2002
    Messages:
    890
    Location:
    Kilcock, Ireland
    Do you only want to delete some specific files in the directory? Or remove all files and folders?

    try: rmdir examplefolder /e

    Should remove that folder and everything in it.

    On windows 10 you could also reboot windows by holding down shift then selecting restart --> troubleshoot--> advanced options--> command prompt.
    You will be asked to select the user account and input login password if you have one set, if you don't have password leave blank and select next.

    Run your delete commands from this command prompt.
     
  16. de_overfiend

    de_overfiend Member

    Joined:
    Jul 12, 2001
    Messages:
    2,209
    Location:
    Gold Coast
    if you just want to delete the files, make a hirens usb and boot from that ... latest hirens is win10 ... browse to specific folders/files and delete
     

Share This Page