How can we delete a Windows file using Command Prompt

When we want to We delete a file out of an operating system Windows, we can do this very simple by clicking on it and selecting Delete from the displayed menu, or selecting the file and pressing the key Delete (In this way the file will be sent to Recycle Bin, where can later be sters permanent of the system or may be restored if applicable).

send-file-to-recycle-bin

If we want to delete the direct file (without first sending it in Recycle Bin), we use either the combination of keys Shift + Delete, either we hold the key Shift While we select the option Delete from the click-right menu of the respective file.

permanently-delete-file

In some cases, however, the file may be blocked by the system (I mean process or service running in background) and we can't delete it. For such situations, we can use either a aplicatie third-party in order to force to delete the file respectively we can use Command Prompt.

How do we delete a Windows file using Command Prompt?

  • open Command Prompt with Administrator privileges (taste cmd in Start Menu or Start Screen, then click-right on it and select Run as administrator)
elevated-cmd
  • identified the way to the file you want to delete by holding the key Shift and by clicking on it, then selecting the option Copy as path from the displayed menu
copy-as-path
  • in Command Prompt taste command del “file-path” (where file-path it is the way to the file you want to delete; for example of the “D:Stealth’sDesktoptest.txt”)
delete-file-cmd

If the file you want to delete is blocked by the system, you can the strength of deletion to it Command Prompt using the command del /F “file-path” (for example del /f “D:Stealth’sDesktoptest.txt”).

force-delete-file-cmd

If you want to DELETE all files A folder, taste command del /A “folder-path” (Where the way folder-path it is the path to the folder respectively; for example, from /a “D:Stealth’sDesktopfolder”), then tutted y for confirmation. Using this command Only files contained by the folder they will be erased, not the folder itself (or any subfoliation).

delete-files-from-a-folder-cmd

Note: If you delete a Windows file using Command Prompt, it will be permanently deleted, without being first sent to Recycle Bin (ie the file can no longer be recovered after deletion).

STEALTH SETTINGS – How to delete a Windows file using Command Prompt

Passionate about technology, I like to test and write tutorials about Windows operating systems, seeking to discover interesting things.

Home Your source of IT tutorials, useful tips and news. How can we delete a Windows file using Command Prompt
Leave a Comment