How to force delete files in Windows 10
If Windows prevents you from deleting a file, you can use a single command to force delete the file from the command line. Here's how you do it.
How are files in Windows deleted?
You can usually delete almost any file or folder by pressing a button Delete
on the keyboard. Once deleted, the file will be moved to the Recycle Bin so you can restore deleted data as needed. To bypass the Recycle Bin and permanently delete a file, you can use the keyboard shortcut Shift
+ Delete
.
When a file is being used, it cannot be deleted in normal ways. If you try to do that, you may receive the "Access Denied: File in use" error message . This is mainly because the file is locked by an application. There is usually no simple way to know which application is blocking a file and prevent you from deleting it.
In those situations, you can execute a command to force the deletion of files.
Important note : Before forcing deletion, make sure that no important data is stored in the file and that it is safe to delete the file. Also, make a backup before deleting the file. Once deleted, you cannot recover files.
Force delete file
To force delete a file in Windows, we will use a single command line. As soon as you execute the command, the target file will be deleted.
1. The first thing you need is the file path. Open File Explorer and go to where the file is stored. Next, click on the address bar and copy the path.
Copy the file path2. Now, open the Command Prompt with admin rights.
3. In the Command Prompt window , execute the command below, replacing X with the actual drive letter. For example, the article file is stored in drive E :. So E is entered in the command below.
If the file you are trying to delete is in C drive, you can skip this step.
X:
Execute the command with the file drive to be deleted 4. When you are in the destination drive, execute the command below, replacing it with the actual path you copied earlier.
cd "E:DummyFolder"
Execute the command with the copied file path 5. This step will take you to the file directory. Now, execute the following command, replacing fileName.ext with the actual file name along with the extension.
In the example case, the file to be deleted is a zip file. So the file name along with the .zip extension is entered.
del /s /q "fileName.ext"
Execute the command with the actual file name along with the extension 6. If Windows can delete the file, you will see a Deleted File response .
You should read it
- Delete the most 'stubborn' files on Windows
- Delete files on Mac directly without the Trash trash
- How to add trash to permanently delete files on Windows 10/11
- How to batch delete files on Windows 10
- 2 ways to permanently delete files on Windows
- How to view recently deleted files on Windows 10?
- Steps to Delete junk files on Windows 10 thoroughly and effectively
- What is Temporary File? How to delete temporary files on windows computers
- 3 ways to delete recent files and folders in Windows
- How to schedule automatic file deletion in the folder Download Windows 10
- How to Delete Temporary Files and Delete Prefetch Files from Your Computer
- Fix 'These Items Are Too Big To Recycle' error on Windows 10
Maybe you are interested
9 ways to fix the error of not being able to save files as JPEG or PNG in Photoshop
Download standard and beautiful Word file experience initiative cover template
How to use the file search command on Windows, find saved files
How to split sheet into multiple separate Excel files
How to merge PDF files, merge and join multiple PDF files into a single file
How to clean up iPhone junk, delete junk files to free up iPhone storage