How to Delete Files using Windows Command Prompt

Deleting files is easy thing; you just need to right-click on the file and click on Delete option. Yet, there are some files which can’t be deleted and they are in use by another application so you can’t delete a file with the mouse click. So, when files cannot be deleted from Windows Explorer then it can be easily deleted from Command Prompt. Want to know how? Well, here are the steps to delete files using Windows Command Prompt.

Method 1: Preparing File for Deletion

First locate your file:

  1. If you know where the files are located then move to it and open the appropriate folder.
  2. In case, if you don’t know where the file is then go to Start search and type its name then right-click the file, when it pops up, click on it and open the file location and go to the file directly.

Note: Here the exception is, if you are trying to delete a file from the “System32” folder, which is Windows’ system files folder then keep your file there only.

  1. Next, click and drag your file onto the desktop so that it will make the deletion process easier as you won’t have to change the deletion location from within Command Prompt.
  2. Now, right-click your file and this will prompt a drop-down menu.
  3. Next, click Properties present at the bottom of the drop-down menu.
  4. Look at the file extension. The file’s extension will be listed near the top of the “General” tab in the “Properties” window and to the right of the “Type of file:” text. Here, you need to know your file’s extension in order to delete it using Command Prompt. Some of the common extensions include:
  • .txt for Text files
  • .jpg or .ping for image files.
  • .docx for MS Word files.
  • .mov, .wmv, .mp4 for video files.
  • .mp3, .wav for sound files.
  • .exe for executable file
  • .link for shortcut files.
  1. Write down the file extension and now you are ready to use Command Prompt.

Method 2: Deleting the File with Command Prompt

  1. Open Command Prompt. Here, you want to avoid the “Administrator” (or “Admin”) version of Command Prompt unless if you are deleting a file in the “System32” folder. You can open Command Prompt in various ways depending on the version of Windows you are using:
  • Hold down ? Win and press X, then click on Command Prompt above the Start button.
  • Next, right-click on the Start button which is in the bottom-left corner of the screen and click the Command Prompt in the pop-up window.
  • Now, type “Command Prompt” into the search bar of Start menu (In case of Windows 8, move your mouse to the top-right corner of the screen and click the magnifying glass) and click on the “Command Prompt” icon as it appears.
  • Now, open the “Run” app from the Start menu and type “cmd”, and on click OK.
  1. Next, type cd desktop and press Enter. This will change the location (or “directory”) in Command Prompt to your desktop.
  • By opening Command Prompt in “Administrator” mode, it will change the directory to the “System32” file. Hence, do not open Command Prompt in “Administrator” unless your file is in the “System32” folder.
  1. Type del [filename.filetype]. Replace “filename.filetype” with your file’s actual name and extension.
  • If there are spaces in file name then place quotation marks around the file name: “I likeicecream.jpg” instead of I_like_icecream.jpg or similar.
  • If you want to delete all files of same extension saved on your desktop then type *.filetype where “filetype” is the extension (e.g., *.txt).
  • Then press Enter there you will see a new, blank line appear in Command Prompt and your file will be deleted now.
  • As the “del” command removes files directly from your hard drive, no need to delete the file again from the Recycling Bin.

But, after deleting files from Windows Command Prompt if you find important ones are missing then worry not; you are at right place; Yes! File Recovery software by Remo helps in recovering files deleted using Command Prompt with ease. Not just that even files emptied from Recycle Bin, if the file bypasses the Recycle Bin, etc. in all such scenarios this tool comes handy. The added advantage of this tool is it comes with free trial version, so you can first check the recovery results and later purchase the tool. Also, there is round the clock technical assistance provided by support team to solve your queries related to the product.