Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to delete a file named "Kanno, Yoko - Where Does This Ocean Go?.mp3" from my hard drive in Windows 7 Ultimate x64 and it keeps telling me that it cannot because the file name is too long or invalid (due to the "?" in it). I cannot rename it, cannot delete it, cannot do so either with Explorer or with CMD. I also cannot delete the folder containing it either with Explorer or with CMD.

Does anyone have an answer or suggestion to try? I have no idea how such a name ever got created in the first place (software to rename files according to their title, but still, it should not have been saved with an invalid name like that). Regardless, how can I now get rid of it?

share|improve this question

migrated from May 25 '12 at 21:58

This question came from our site for professional and enthusiast programmers.

A file cannot be created or renamed using a filename that contains a '?' character. It is a reserved wildcard character. Maybe your filesystem got corrupted at the hardware layer. – Remy Lebeau May 24 '12 at 21:35
It's only a widcard to shell input. AFAIK the disk sub-system calls don't care. – starbolin May 24 '12 at 21:40
@star Windows APIs will all object to that filename – David Heffernan May 24 '12 at 21:42
Windows API may object to that filename, but so does every flavor of Linux I've ever used. It was not named normally, I can guarantee that much. Probably done with an app under Ubuntu Linux many versions/years ago. I am quite annoyed that Windows won't let me rename it correctly nor delete it though. – Uncle Code Monkey May 25 '12 at 5:24
The GUI shells in Linux may object but I doubt that the command line shells do. *nix has always allowed wildcards, suitably escaped, in filenames. – David Heffernan May 25 '12 at 5:54

Try this from the command line:

del Kanno*.mp3

Or perhaps try to find the short name of the file and delete that. I think dir /x will list the short names, but my recollection is hazy.

The only thing I can imagine that might produce that is an invalid character encoding. When the system encounters text that has been encoded incorrectly it can display as "?".

Windows is more careful about not allowing wildcards in filenames that some other systems. Many years ago I remember a colleague making a file named * on a UNIX system. That incident did not end with smiles.

share|improve this answer
del * does not work. That was my original problem as the entire folder was being deleted. "dir /x" did not list any short name for the file even though there is a space in the first 8 characters. – Uncle Code Monkey May 25 '12 at 5:19
up vote 1 down vote accepted

Resolved: I plugged the hard drive into an external casing and connected it via USB to my Android tablet as a USB drive. Using my Android File Browser, I navigated to that file and deleted it. Android will not let you name files with "?" in them either, nor could I play that file while it had an "?" still in it, but Android let me rename/copy/move/delete it, so problem solved, just not with Win7. FYI, I could play the mp3 file just fine once I removed the "?" from the name.

share|improve this answer

Microsoft has an Article about hard to delete files.

Most of the time for me, prepending the path with \\?\ does exactly what I want. So you could try del "\\?\c:\path\Kanno, Yoko - Where Does This Ocean Go?.mp3"

There is also \\.\ and I don't know what the exact difference to \\?\ is.

Both prefixes seem to disable some checks and/or make del use lower level APIs than the usual Win32 API.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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