PDF download Download Article PDF download Download Article

If you see "Cannot delete <filename>: Access is denied", there are a few ways to delete the files permanently. Make sure the file you're trying to delete isn't currently in use. Here's how to delete a file or folder showing the error "Access is denied".

Method 1
Method 1 of 5:

Using a Keyboard Shortcut

PDF download Download Article
  1. It should be highlighted.
    • Keep in mind that this method will permanently delete the file. Back up the files if you want to recover them later.[1]
  2. This keyboard combination will bypass the Recycle Bin and delete the file permanently.
    • Del is different from the backspace key and can be found on the right side of a full-sized keyboard.
  3. Advertisement
Method 2
Method 2 of 5:

Closing Open Files

PDF download Download Article
  1. The most common cause of this error message is a program currently accessing the file you are trying to delete. For example, if you are trying to delete a document that is currently open in Word, or trying to delete a song that is currently playing.[2]
  2. Press Ctrl+Alt+Del and select "Task Manager" from the menu. Click on the "User Name" tab and find the entries under your username. Most of these programs can be ended without causing the system to crash.
  3. You can do this by selecting them and clicking "End Process."
    • If you close a program that causes the system to become unstable, restart your computer to restore.
  4. Oftentimes, restarting your computer will release the hold that a program had on a specific file. Try deleting the file after you have completed the restart and before you open any other programs. If the file still shows the error message, continue on to the next method.
  5. Advertisement
Method 3
Method 3 of 5:

Using Microsoft Process Explorer Tool

PDF download Download Article
  1. https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer. It is free-of-cost and portable. No installation is required.
  2. Advertisement
Method 4
Method 4 of 5:

Running a Third-Party Program

PDF download Download Article
  1. Popular options include Process Explorer, LockHunter, and Unlocker or Lock-UnMatic and Mac OS File Unlocker for Mac. All of these programs are free and integrate into your Windows interface. If you choose to use Unlocker, be wary when navigating their website because there are numerous tricky ads that may lead to malware on your computer.[3]
  2. All of the programs have relatively simple installs. Unzip the file if necessary and open the Setup or Install file. The typical installation settings will work for most users.
    • Some programs may try to install web browser toolbars during the installation. Make sure to deselect these if you don't want new toolbars.
  3. Select the newly-installed tool from the menu. This will open a new window. A list will be displayed showing all of the programs that are currently accessing the file.
  4. Select the program that you want to end and click the "Kill Process" button. Once all of the locking programs are closed, you will be able to delete the file without issue.
  5. Advertisement
Method 5
Method 5 of 5:

Using the Command Prompt

PDF download Download Article
  1. If you are unable to locate the file, try using the Search option. Click the "Start menu" and enter the file name into the Search field. In Windows 8, start typing the file name when you are at your Start screen.
  2. Remove (uncheck) all the attributes of the file or folder.
  3. You will need to relocate this later when forcibly deleting it in the Command Prompt.
  4. You can do this by clicking on Start and typing “cmd” into the Search field without the quotation marks.
  5. Leave the Command Prompt window open, but proceed to close all other open programs.
  6. You can do this by either pressing Ctrl+Alt+Del and selecting "Task Manager" from the menu or by going to the Start menu, pressing "Run," and then entering "TASKMGR.EXE."
  7. Find the process named “explorer.exe”. Select it and click on "End Process." Minimize, but do not close, Task Manager.
  8. Here you may forcibly delete a file or a folder through employing a basic command line tool. While both files and folders can be deleted in basically the same way, there are subtle differences in the command you will use.
  9. C:\Documents and Settings\Your User Name>. This will be in your command prompt.
  10. In the Command Prompt window, enter cd My Documents after Your User Name.
  11. After "My documents," enter the Delete command followed by the name of the file you wish to delete. For example, "del unwanted file.exe."
  12. The final command should look as follows: C:\Documents and Settings\Your User Name\My Documents>del unwantedfile.exe[4]
  13. If you are seeking to delete a folder rather than a file, use the "RMDIR /S /Q" command instead of the "del" command. This will look something like this: C:\Documents and Settings\Your User Name>rmdir /s /q "C:\Documents and Settings\Your User Name\My Documents\unwanted folder"[5]
  14. This will bring you back to Task Manager where you can click File, select New Task and then enter "EXPLORER.EXE" to restart the Windows interface.
  15. The file should now be deleted but you can check by searching for it by going to Start and then entering it into the search bar.
  16. Advertisement

Community Q&A

Search
Add New Question
  • Question
    After I write the proper codes to delete a folder in the command prompt, I get "access is denied" for each and every file inside the folder. Why is this happening, and what do I do to delete the files?
    Community Answer
    Community Answer
    You might not have admin rights on the files. Open CMD as an administrator by right-clicking on it and selecting "Run as Administrator."
  • Question
    Is there anything else I can try if this doesn't work and access is also denied in CMD?
    Community Answer
    Community Answer
    Try using GS RichCop 360. It will do the job very easily and without any errors or popups. The tool is robust and reliable and its performance is commendable.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Tips

  • For more information on DOS Commands, type HELP in Command Prompt window or you can search over Internet.
  • To move BACK to previous directory in Command Prompt window you can use the following command:
    CD..
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement

Warnings

  • This trick will not work if the file to be deleted is being used by some other program. Like an mp3 file that is being played but you want to delete it. In this case close the media player that is playing the file and then delete it.
  • Don't terminate any other process except "EXPLORER.EXE". If done it can cause undesired results including loss of data, system instability and Operating System to crash, or corrupt.
Advertisement

You Might Also Like

Delete a File Using Command PromptDelete a File Using Command Prompt
Delete Files That Cannot Be DeletedDelete Files That Cannot Be Deleted
Take a Screenshot in Microsoft Windows Take a Screenshot on a Windows PC: 8 Simple Tricks
Check Your Windows VersionCheck Your Windows Version
Check Your Windows Product Key Find Your Windows Product Key
Install FFmpeg on WindowsEasily Download and Install FFmpeg on a Windows PC
Check Mouse Sensitivity (Dpi) on PC or Mac Check Your Mouse DPI on Windows & Mac
Start Windows in Safe Mode Start Windows in Safe Mode: 6 Easy Options
Change Your Desktop Background in Windows5 Quick Ways to Change Your Desktop Wallpaper on Windows
Get to the Boot Menu on Windows4 Easy Ways to Access the Boot Options Menu in Windows
Enter BIOS Access the BIOS on Any PC: Guide + Troubleshooting
Turn Off BitLocker Disable BitLocker Encryption in Windows 10 and 11
Move Game to Another Screen3 Easy Ways to Move a Full Screen Game to Another Monitor
Automatically Shut Down Your Computer at a Specified TimeAutomatically Shut Down Your Computer at a Specified Time
Advertisement

About This Article

wikiHow Staff
Co-authored by:
wikiHow Staff Writer
This article was co-authored by wikiHow Staff. Our trained team of editors and researchers validate articles for accuracy and comprehensiveness. wikiHow's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards. This article has been viewed 792,462 times.
How helpful is this?
Co-authors: 24
Updated: March 4, 2024
Views: 792,462
Categories: Windows Files | Windows
Thanks to all authors for creating a page that has been read 792,462 times.

Is this article up to date?

Advertisement