How to Delete Files and Folders via Command Prompt
If you are having trouble deleting a certain file or folder from your computer by traditional means, you may have better luck attempting to remove it via the Command Prompt utility. Obviously this wont be as efficient as simply using File Explorer, but in some cases, you don't have any other options. This tutorial will teach you exactly how to use the Command Prompt to get rid of any file or folder on your PC.
1. Right-click the Windows icon on the bottom-left corner of your screen to access the Power User options, select "Command Prompt (Admin)" to open an elevated command prompt (in Windows 10 you'll need to Add Command Prompt back to this menu first). Alternatively, in Windows 7, you can use the search function and type in "cmd", right click it, and click "Run as Administrator".
2. Once the Command Prompt is open, you can type the follow command (exactly as it is written, excluding brackets, and replace File Path Here with your path) to delete any file on your PC. Once you've typed the command, just press Enter and it will be permanently removed from your computer. Note: These files are gone immediately, they do not go to recycle bin, so be cautious when deleting files via command prompt.
Command:[DEL /F /S /Q /A "File Path Here"]
Example:[DEL /F /S /Q /A "C:\Users\Michael\Downloads\Test.txt"]
3. If you want to delete every file in a single folder, you can do so by using a slightly altered command, and then pressing enter. Note: This will not delete any folders with-in that folder, but it will permanently remove all files in the folder.
Command:[DEL /F /S /Q /A "Folder Path Here"]
Example:[DEL /F /S /Q /A "C:\Users\Michael\Downloads\Test Folder"]
4. Last but not least, is the command to delete an entire folder via Command Prompt. This will remove everything with-in the folder, including sub-folders and files. Just type this command in and press enter, and the folder will be deleted.
Command:[RD /S /Q "Folder Path Here"]
Example:[RD /S /Q "C:\Users\Michael\Downloads\Test Folder"]
Remember to be careful, as these changes are immediate and permanent -- there is no Recycle Bin safe-guard when using the command prompt. Also, if you are having issues, make sure you are running an elevated command prompt (ran as administrator), as specified in the initial step. If you're still stuck, leave us a comment and we'll do our best to assist you in getting rid of those pesky files and folders.