Delete file in Windows: CMD, 10

Delete file in Windows: CMD, 10

Windows is often praised for its ease of use, which is why glitches like problems deleting a file or a folder are especially frustrating. There are many solutions to this seemingly simple roadblock, and this walkthrough will introduce you to the different ways that you might be able to get past it.

Error deleting file or folder in Windows 

The first thing that you should do is identify the source of the issue, which will help you choose a method of solving it. Windows might prevent you from deleting a file or a folder because it is being used by system processes, contains hidden files or folders, is set to read-only mode, or belongs to another user, and you don't possess the right to delete the file. It could also be off-limits to you because the file system of the hard drive contains errors, is infected with a virus, or the hard drive may be failing overall (this being a more serious hardware issue).

Your error message might help be your best clue to diagnosing the problem. Possible messages include error deleting file or folder, can not delete file: access is denied, there has been a sharing violation, the source or destination file may be in use, and the file is in use by another program or user.

How to display hidden system files?

Before you can begin to solve your file issue, you must first display any system files that may be hidden.

  • First open My Computer > Tools > Folder Options > View > Advanced Settings.
  • Check the boxes corresponding to the Display the contents of system folders and Show hidden files and folders options.
  • Uncheck the boxes next to the Hide extensions for known file types and Hide protected operating system files (recommended) options.
  • Finish up by clicking Apply to all folders > OK.

How to reboot your computer in safe mode?

One way to reset your ability to delete system files is by rebooting your computer in Safe mode.

Restart the computer, and tap the F8 key before Windows loads. Try to delete the file again.

How to copy and paste the file/folder to another location?

Another solution is to try to move the file or folder to another location before deleting it. To do this, simply copy the file (Ctrl + C) and paste (Ctrl + P) the file into a new location.

Try to delete the file from its new location.

How to delete via command prompt?

You might be successful in deleting the file by using a command prompt.

Press Ctrl + Alt + Del, and stop the explorer.exe process. Both the icons and the taskbar will disappear.

Next, click File > New Task > run cmd.

Access the folder by using the following command:


Then, delete the file using the following command:


Finally, click File > New Task, and run explorer.exe.

How to scan your hard drive?

If you are still unable to delete the file, you may need to perform a scan of your hard drive. We recommend that you scan the disk with Scandisk.

Right-click on the hard drive/partition, and then, click Properties > Tools.

In the Error Checking section, click Check Now.

Try to delete the file once the scan is complete. Repeat this procedure in Safe mode, if necessary.

How to launch an antivirus scan?

You may also want to try scanning the computer with an updated antivirus in order to get rid of a stubborn unwanted file.

Software alternatives

If none of these options work, you may want to try out additional software to help you through the process.

Any more Windows questions? Check out our forum!
Around the same subject

Windows 10