I have a file with this name "Registering wrong app ", there are a few spaces in the file name, now I can't delete it, it won't even let me change file name, I also tried to delete it from my Java program, it won't let me either, how to delete it ?

When deleting it from Explorer, I got this :

Could not find this item
This is no longer located in C:\My_Dir\.
Verify the item's location and try again.

Registering wrong app
Type: File
Siz: 0 bytes

The strange thing is, this file is invisible to the system, it's 0 in size and has space in it's name.

Edit [ Result ] : Thanks for offering so many ways to skin this tough "cat", I finally got it done, the answers below reminded me of the old days, and the command "del *" killed the cat ! It was the only file left in that dir, and that did it, thanks everyone !

link|improve this question

80% accept rate
What message do you get when you try to delete it from Explorer? – Stephen Jennings Feb 13 '11 at 23:40
feedback

5 Answers

up vote 5 down vote accepted

You can do it like this:

del /F "\\?\C:\My_Dir\Registering*wrong*app*"

This will match any amount of characters between and after the words, and also works on wrong files.

If you don't have other files that start with Registering, you might as well try:

del /F "\\?\C:\My_Dir\Registering*"

If the file is undeletable, use Process Explorer and search for the handle and kill the owning process.

Find --> Find Handle/DLL (CTRL+F) --> Type in Registering --> Kill the matching processes.

link|improve this answer
instead of Process Explorer,use "unlocker" (ccollomb.free.fr) – Alejandro Angelico Feb 14 '11 at 1:22
4  
instead of unlocker, use "Process Explorer" (Microsoft Windows Sysinternals), safe and useful ;-) – Tom Wijsman Feb 14 '11 at 2:00
1  
Man, this answer takes me back to the DOS 3.1 days. Can always "drop to DOS" (now a command box). Thanks for the effective nostalgia. – Mike Feb 14 '11 at 4:30
feedback

Try putting the filename in quotes, but replacing the spaces with question marks, like this:

del "registering?wrong?app"

That should delete the file if the spaces aren't really spaces, but nulls or some other invisible character.

link|improve this answer
feedback

Open a command prompt, and change to the My_Dir directory

cd \My_Dir

Get the short (8.3) file name for the file.

dir /a /x /p

You should see something like

02/13/2011  07:25 PM             1,010 REGIST~1     Registering Wrong App

The REGIST~1 is the short file name. Try the del command with that name.

del REGIST~1
link|improve this answer
feedback

Spaces shouldn't matter if you are trying to delete the file from Explorer. If you are trying to delete from the command line simply put the file name in quotes like this del "Registering wrong app ".

If this does not work you have something else holding you up other than spaces in the file name... like a process that is "locking" the file, thus preventing deletion.

link|improve this answer
feedback

Delete dirs or files with a space in it:

dir /a /x/ /p

"files or dirs with space"

c:\DIR1WITHSPACE~1
c:\DIR2WITHSPACE~2

ren DIRWITHSPACE~1 TEST

del test

"Job done...."
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.