• How do you delete a file that won’t delete?

    Home » Forums » AskWoody support » Windows » Windows 11 » Questions about Windows 11 » How do you delete a file that won’t delete?

    Author
    Topic
    #2727191

    Hi,

    I’ve tried everything I could think of to delete a file on my desktop. It’s giving errors everytime I sync this machine with others. What can I do?

    Background: I tried to download the older version of Autohotkey and our virus software prevented it. So I had the bright idea of renaming it with a doc ending and trying to fool the corporate virus software. That got the exe file to the desktop, but the virus software locked it down. I confessed my sins to the IT department. Our IT guy says he’s granted me privileges over the file from the virus software, so I can delete it, but Windows disagrees. My latest attempt was to try Windows Powershell as administrator. I’m getting a rights error.

    Am I using the right command? I used:

    Remove-Item ‘c:\Users\John\desktop\AutoHotkey_1.1.37.02_setup.doc’ -Force

    Anything else I could try? Thank you.

    Viewing 8 reply threads
    Author
    Replies
    • #2727228

      I’ve tried everything I could think of to delete a file on my desktop. It’s giving errors everytime I sync this machine with others. What can I do?

      Usually, a virus protection software will quarantine a file and you can delete it from there, so this is unusual. One thing you could try is going into “Safe Mode Command Prompt”.

      Press “Shift” and hold it, and then hit “Restart” while continuing to hold the shift key until it comes up with this menu:

      20241220_112228

      Press the “Troubleshoot” button:

      20241220_112336

      And select “Enable Safe Mode With Command Prompt”. (There are a few other menu items you need to select to get to this screen, but I’m not sure if you might not already be familiar with this or not, so I left it out. You could search how if you need more assistance.)

      20241220_112704

      So, once you get to the command line, just get to your desktop (obviously replace your User Name with mine) and delete it from there.

    • #2727247

      I’ve tried everything I could think of to delete a file on my desktop

      Have you tried restarting your PC so that the software that lock the file will release it ? You can also use the Portable IObit Unlocker app

    • #2727279

      Is there a possibility that you didn’t unblock the file after it was downloaded to your desktop?

      If so then it will have a Zone.Identifier alternate data stream attached to the file to show the OS it came from elsewhere, irrespective of its new file extension. This Zone.Identifier is a safety feature that can prevent normal file operations.

      Here’s how to check and remove any such ADS attachment using PowerShell.

      1. Right-click on Start; select Windows PowerShell (Admin).

      2. When the elevated PowerShell console opens, copy/paste/enter the following:

      Get-Item c:\Users\John\desktop\AutoHotkey_1.1.37.02_setup.doc -Stream Zone.Identifier

      (Note that you don’t need to use any quotes because there’s no spaces in the filepath.)
      The result will show you if there is indeed a Zone.Identifier alternate data stream.

      3. Next, copy/paste/enter the following:

      Remove-Item c:\Users\John\desktop\AutoHotkey_1.1.37.02_setup.doc -Stream Zone.Identifier

      4. Use the UP arrow key to repeat the command in step 2. This should show an error because there is no longer any alternate data stream attached to the file.

      5. Copy/paste/enter the following:

      Remove-Item c:\Users\John\desktop\AutoHotkey_1.1.37.02_setup.doc -Force

      Here’s a screenshot of what I saw on my device (where I log into Windows as user) when I downloaded the same AutoHotkey installer to my desktop, didn’t unblock it but renamed the file extension from exe to doc:

      powershell_remove_zone_identifier

      Hope this helps… post back your results.

    • #2727329

      When I’ve been unable to delete files, I boot with a Linux boot drive and delete it from within Linux.

      Linux Mint very easy to use

    • #2727426

      Thank you all for all your help. None of the solutions work, but in working through them I happened to notice in the system tray where the antivirus program resides that it looks like they granted an exception for the EXE file but not my fake DOC file. I’ve reached back out to the IT people to see if they can do something with this.

    • #2727427

      I have not tried the Linux Mint solution yet. I’ll try that next.

       

    • #2727451

      Try to zip the file with 7-zip. Trick is to use the option: delete original file. That way I have been able in the past to delete a file with two dots in the filename…

    • #2727539

      When I have a file or folder that won’t let me delete it and I don’t want to mess around Admin commands, take ownership, etc., I use a free program, UnLock IT, that does the job very nicely. You can get at the link below:

      EMCO UnLock IT

      HTH, Dana:))

      1 user thanked author for this post.
    • #2727849

      None of the solutions work, but in working through them I happened to notice in the system tray where the antivirus program resides that it looks like they granted an exception for the EXE file but not my fake DOC file. I’ve reached back out to the IT people to see if they can do something with this.

      It sounds like you are working in a hybrid managed environment. It also sounds like you have a working relationship with the ‘IT people’.

      Can the ‘IT people’ not delete the file from your desktop for you?

      Can you not rename the file extension from doc back to exe then retry an elevated PowerShell console?

      In your first post you mentioned that using PowerShell gave a ‘rights’ error. What’s the actual PowerShell error?

      1 user thanked author for this post.
    Viewing 8 reply threads
    Reply To: How do you delete a file that won’t delete?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: