How to easily delete an access denied folder by cmd

Who I am
Marie-Ange Demory
@marie-angedemory
Author and references

Microsoft computers with Windows operating system offer the administrator many licenses to be able to perform actions such as moving files, copying them and even deleting them. However, it can happen that we are not the main administrator of the computer we are using and we need to delete a file, how could we do in that case?

Likewise, it may happen that access is denied to certain files or simply does not allow us to delete them. For those cases we will have to use the System Symbol or CMD and with a few simple commands we can delete these files that refuse to be deleted.



Generally when we try to delete a file or folder and it won't let us delete it, we will get a message with the following error: Cannot delete file: access denied. The source file may be in use

This is because the recycle bin does not include the mounted volumes. That is, when trying to delete a path on drive C: for example, Windows Explorer interprets that the file or folder is on that drive but fails and therefore cannot move it to the trash.

If this happens to you constantly and you don't know how to fix it, in the following article we will explain step by step how to easily delete a folder with access denied by cmd.

Delete files that cannot be deleted from CMD

This is one of the best CMD commands for Windows, as you will be able to delete any file that refuses to delete. The first thing to do is click the Start button and in the search bar type CMD or Command Prompt.


You can right-click on the command prompt and select the Run as administrator option if you want to have access to everything. Otherwise you can skip this step and it will still work. The commands must have the following formula: DEL / F / Q / AC: Users Enter your username Enter file path here Enter file name here


  • Of: support to delete
  • /F: support for forced deletion
  • /Q: support for not showing notifications like Do you really want to delete the file?
  • / AT: This command represents the file attribute, such as archive or hidden.
  • / C: represents the main drive of the disc.

this is useful for removing viruses that cannot be removed. In this way we write the following command in CMD: DEL / F / Q / AC: Users PCWebtips Desktop virus.exe and press enter to complete the action.

Another alternative to delete files with access denied

When deleting files, you can use the Shift + Delete key combination. This will skip the sending process to the trash and the files will be permanently deleted.

You can also open a CMD command window in Windows 10 and use the Rd / s / q command to delete files or folders that cannot be deleted regularly. It is important to note that both methods will permanently delete the files.


Commands for deleting files in Windows

With command prompt, you can do anything, from opening a web page deleting malicious files, viruses or locked folders. However, multiple scenarios can occur, such as deleting a file or folder, deleting several, or deleting read-only files.


Depending on what you need, it will be more useful to run one command or another. For this reason we will explain the different ways to delete files from CMD so that you can decide whether to delete one or more files and folders.


Command to delete a file

Open CMD and use the "cd" command to go to the folder of the files you want to delete and execute the "DEL" command to delete. An example of the command would be this: DEL / F / A file.extension > parameter F will force the deletion of the file while A will delete only the files marked by Windows.


Command to delete multiple files 

To delete multiple files you can use the wildcard "*" which is ideal for deleting many files with specific names. c: / Users / vamsi / Desktop / del> * c: / Users / vamsi / Desktop / del> * Are you sure (Y / N) And c: / Users / vamsi / Desktop / del>

TagsTutorial PC
add a comment of How to easily delete an access denied folder by cmd
Comment sent successfully! We will review it in the next few hours.