90

I have a song that Windows can't play because there is a question mark in the name of the file.

"Where Have All the Cowboys Gone?.ogg" // as an example

So I try to rename it and Windows complains whether I try it in Explorer or from command prompt.

Error I get when trying to copy, rename, or move is:

The Filename, directory name, or volume label syntax is incorrect

Is there a Windows way to force a rename in this case?

Update

I'll keep an eye on this question, but after 13 answers and many attempts (aside form 3rd party solutions) it seems that Windows can't do this (or at least my windows can't, no short names). So I'm accepting the answer which was my original solution anyway of using Linux. It would be nice to see Windows handle this somehow, so don't stop just because I've accepted this answer, the question still stands!

9
  • 5
    May I ask how you got to this state? Windows generally won't let you do this. Aug 28, 2009 at 19:55
  • and the answer is that I got the file from a Linux box. it's actually an .ogg file too. but I was wondering since I'm at work and haven't got my linux how to do it in windows... would be nice to know
    – codeLes
    Aug 28, 2009 at 20:00
  • 7
    The filesystem NTFS allows some characters that Windows doesn't. If Windows meets such files, it b0rks. Aug 18, 2012 at 0:25
  • 1
    I once had a flashdrive go bad, chkdsk moved the files to a different sector but kept the damaged names which contained fun characters such as CRLF or even backspace. :)
    – Nulano
    Feb 9, 2017 at 15:59
  • 1
    @IvanChau: Not a duplicate. That other question is about a space in the name, which is, in fact, a piece of cake, unlike this one here (with a wildcard).
    – Sz.
    Dec 17, 2017 at 4:13

37 Answers 37

1
2
0

In most cases this answer is useless.
I got fooled by filenames with characters that are represented as question marks when in fact they're just characters the default M$-fonts won't/can't display.

Should I delete this post? It still might help some people...


Try using the cmd.exe built in tab-completion.

  1. dir /x does not help (the NTFS was created without support for short file names):

    dir
     Verzeichnis von C:\Temporal\_black
    05.10.2015  21:23    <DIR>          none\none         ? ?????????, ?????????
    
    dir /X
     Verzeichnis von C:\Temporal\_black
    05.10.2015  21:23    <DIR>                       none\none         ? ?????????, ?????????
    
  2. Trying to rename it by typing / copy'n'pasting the name does not work:

    C:\Temporal\_black> ren "? ?????????, ?????????" bart
    Syntaxfehler.
    
  3. To make it work you have to use tab-completion. Just navigate to the right directory in the cmd-shell, type ren, hit the tabulator-key and keep hitting it until the 'correct' name appears:

    C:\Temporal\_black>ren "? ?????????, ?????????"
    

    then type up the rest and hit enter:

    C:\Temporal\_black>ren "? ?????????, ?????????" bart
    

    You will be rewarded with this:

    C:\Temporal\_black> dir
     Verzeichnis von C:\Temporal\_black
    05.10.2015  21:23    <DIR>          none\none         bart
    

It's kinda tedious but so far this has always worked for me with files and directories (Windows 7 and 8).

Funny side note: The ren-commands in 2. and 3. are identical but it wont work without using tab-completion. And even if you've used tab-completion it wont work anymore as soon as you edit the name after the ren (e.g. remove and add a question mark).

0

I had exactly the same problem with a file I had downloaded. I couldn't rename or move it, either in Explorer or the command line. However, what worked for me was to delete it in Explorer, and then restore it from the recycle bin. I can only assume this process "corrected" some of the invalid characters as I was then able to treat it like a normal file.

1
  • The filename is invalid or too long Mar 9, 2017 at 4:25
0

Sorry kinda late, not sure how to remove the one file however you can all the files in the directory. Just create a Empty folder and then use robocopy to mirror that new empty folder over the top of the one with the bad file. This basically mirrors an empty list over the top of whatever was there.

mkdir Empty
robocopy Empty <badfiledir> /mir
0

I had a problem with a filename which had a trailing blank. Neighter Explorer nor cmd.exe move was able to rename (or delete) it.

I then used FAR Manager (far.exe in ConEmu). It is a console Norton Comander clone which works on 64-bit Windows 10.

With this I was easily able to see and change the trailing blank.

0

The only thing that helped me was to download LockHunter

kill the processes from withing LockHunter, then renamed the folder, however LockHunter also does have option to rename folder.

0

OK, for me the thirdparty tool isobuster from smart projects worked well with a personal license. Just extract the folder/files to a windows ntfs drive and all non-windows characters are transformed to well formed windows folder and filenames. Ugh. :) Hope that helps! I will delete the non-conform folders next time I use my lubuntu system ;) - All that folks!

0

I was not able to make any of the suggested Windows utilities work for me to remove "?" and "*" characters from a filename.

I plugged the drive into a Raspberry Pi and changed the filenames.

1
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .