At times you want to delete stuff on your PC, but you cannot do it. In the piece below you will see how to force delete a file/folder with CMD on Windows. Thus the chance to solve the “can’t delete a file/folder.” Such an error always pops up when;
- You lack the privileges of deleting the file/folder
- The file/folder you are trying to delete is in use
- The file or folder is running in the background thus cannot be deleted
- Because the file or folder is being used by other applications/or rather it is open in other applications
- The file name/extension exceed the recommended size
- The disk is corrupted
Force Delete a File/Folder with CMD in Windows
Below is a step by step process on how to force delete file/folder with CMD in Windows;
- Step 1. Open CMD and Run as administrator
On the taskbar search box, just type CMD, then choose run as administrator.
- Step 2. To delete a file, on CMD, type del, followed by the path of the file you want to delete, and press Enter, i.e del file path. For example del C:\Program Files\Oracle\VirtualBox\doc.pdf
Ensure that you indicate the file extension, .txt, .docx, .xls, .pdf. If you need to check the path of a file folder, just right click on the file then click on properties and copy the file path. Here you will also be able to see the type of file extension. Just like the one below;
- To delete a folder, use the rmdir /s /q command, followed by the folder path. For example; rmdir /s /q C:\Users\Valentine\OneDrive\Documents\Zoom
By doing this you will be able to force delete file/folder with CMD in Windows. Please check this article how to find the path of a folder on file explorer if you have encountered a problem of not being able to locate your folder path.