Delete Files from Desktop with Command Prompt

Posted on March 13, 2011 in Windows Category

If you can't delete files from desktop, this tip will learn you how to delete files forced from your desktop with some tricks, if they won't delete using the normal way. These steps are the same in Windows XP/Vista/7 using Command Prompt and Task Manager and some MS-DOS old commands.

Windows 7 Command Prompt

First of all we need to access Command Prompt (cmd.exe) as Administrator to have the full rights to delete the file. You can find more details about Command Prompt here.

Go to Start and type in the Search Bar - "cmd", right click on the item found (cmd.exe) and select  Run as Administrator or press Windows Key + R (Run) and type cmd.exe.

Run Command Prompt from Start Bar

The default path for Administrator is C:/Windows/system32. We need to access the Desktop Path (C:/Users/Your_Windows_Account/Desktop. How do we will get there?

Use these commands:

  • "cd.." - Exit from the current folder
  • "cd folder" - Enter in the folder specified (Example: cd Windows)
  • "del filename.exe" - Delete a specified file
  • /f  - Delete forced
  • /q - Quiet Delete (Without Delete Confirmation)

Delete Files from Desktop with Command Prompt

Note: If you can't delete files from Desktop with Command Prompt, you need to run Task Manager, end/close explorer.exe process and you can try deleting the file again.

Can't Delete Files from Desktop with a Long Name?

What about if you can't delete files from desktop with a long name and has space between words?

For example your will have a file named "Extreme Design Studio.exe". How you will delete this file? When you will try to delete files from desktop like this using Command Prompt, you will receive a message like this: "Could Not Find Specified File"

So, remember the old MS-DOS ? When you type the dir command all the long names will be displayed only with the first 6 characters followed by ~1 and file extension. For example we have the file "123456789.exe". MS-DOS will read the file like this "123456~1".

In this case you will write "del extrem~1.exe /f /q" and the file will be deleted.



Corrupted files may cause High CPU Usage on the Process explorer.exe and this will lead to Windows Malfunction. If you will notify that your system is running slowly, the explorer.exe process is using CPU between 90% and 100% for nothing, so what to do? What is the reason of this?

Most of all cases there are Corrupted Media Files with No Size (Zero KB) - (avi, flv, etc). The system will try to read meta data from these files, and this cycle will repeat again and again (infinitely), so you will have a High CPU Usage because of this.

A Virus / Spyware / Malware. Those will reduce your computer performance. Try using  an Anti-Spyware Software to remove them from your computer.

Related Articles
  1. Joy says:

    Hi Dan!

    Great tip! I was wondering how I could delete all the files having the same extension at one go using this technique. It’s because I have a large number of files with different extensions and want to delete them at one go! Any idea apart from creating a separate .bat file?!

  2. Patrick says:

    Hello friends, try long path tool, it’s awesome.

  3. sandeep says:

    I have a file named ‘sand’ on desktop and it’s path is c:\users\flgbr\desktop\sand. When i type the the path it says ‘is not recognised as an internal or external command, operable program or batch file. Please help me ….

    • Hello. Please read the tutorial carefully again.

      You need to type the extension of the file name too. Type “dir” when you are in the “flgbr” and see what extension have your file. You should access the file like this:

      cd desktop

  4. Suzy says:

    Sorry again but I’m in the G drive but I just get “(foldername) is not recognised as an internal or external command, operable program or batch file”.

  5. Suzy says:

    Hey, thank you for sharing this, really helped. Do you know if there is a way as simple/similar to this to delete from an external hard drive. I back everything up and stored the file before I knew I couldn’t delete it. And well, I’d like to try this before reformatting and spend hours backing everything up again since this works. Thanks :)

    • Hello Suzy,

      You can do this with the same steps, but you need to access the external hard drive from Command Prompt, instead accessing the main hard drive.

      • Suzy says:

        Thanks for replying. Sorry but how do I access it, I’m not similar with cmd prompt. If the steps are the same I just need to know how to access the harddrive

        • First you need to check in My Computer, what letter you have assigned on your external hard drive. Then you can go in Command Prompt and type that letter from your hard drive. For example:

          E: or F: or G:

  6. emember says:

    Thanks!! I had corrupted, empty flv and avi files that would not permanently delete. In your eg. how would “Extreme Design Studio.exe” look like in Vista DOS? And say if I had several files all beginning with “Extreme” ? I tried writing out a maximum of six characters from each word, followed by its extension but no luck. Finally, do spaces count as characters?

    • Hello emember,

      The word “Extreme” have 7 letters, so you will need to to split it in 6 letters like this “extrem~1.exe” so you can delete it. The same shell console is for Windows XP/Vista/7.

      • emember says:

        Thanks. I deleted all the corrupt, empty fly and avi files but they’re back as soon as I enter firefox. What’s more they’re multiplying..I now have 20 empty files; six different files have grown to over 20 (they’re all identical versions). Here’s what I’ve tried; your suggestion above, Avast and Malwarebytes including the latter’s File Assassin, CCleaner, removing the add-ons from Firefox where I tried to initially download the original files, combining them with a Word Doc so they’re no longer empty then re deleting. I even uninstalled my media players. The empty files always vanish no problem, but quickly return !! I run Vista home premium on a 64bit machine. Any ideas?

  7. GabrielNar says:

    Very nice post. Thanks for sharing this amazing tip. It worked for me.

    • Perfect! If you have any tips to share with us from your personal experience, you can register and post your solution! We will write your name and website in the description info.

  8. kyle says:

    i followed the steps and it recognized but said access is denied

  9. Andrew says:

    the tutorial is very helpful however upon doing the steps as mentioned above,the command promt says \’\’ the proccess cannot access the file because it is being used by another process \’\’

    any idea why?

  10. Benjamin says:

    EDS, THANK YOU so mUCH!!!!!! i had such a hard time finding someone who actually could be a bit more precise and would mention about the spaces in names! you are a legend! thank you so much!

  11. piecemealcranky says:

    Great tip, works for files running in backgrounds, thanks!

Hint: Wrap your code syntax (html, css or others) between <pre> and </pre> tags. All comments are moderated.

× 4 = twenty

Subscribe by E-mail

HTML-TUTS is built under the mighty WordPress platform.