strange file names

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
joejames_786
Posts: 17
Joined: 12 Feb 2017 05:11

strange file names

#1 Post by joejames_786 » 02 May 2018 07:24

hi

can anyone help me with this?


I have some text files with names that that does not allow me to rename that particular file
(eg.. some diamond shaped characters) when I try to copy that filename to a text file
the name translates to a series of ???????????????????????????.txt

how do I rename these files


thanks

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: strange file names

#2 Post by Squashman » 02 May 2018 08:06

How are you trying to rename them?

uglyninja
Posts: 7
Joined: 18 May 2018 14:22

Re: strange file names

#3 Post by uglyninja » 18 May 2018 14:43

First - how did you already try to rename them?

Did you try the batch way:

Code: Select all

ren {insert file name here} {insert new name here}
Did you try the classic way, right click the file and change the name?

Also, maybe share some screenshots so we can see the names?

- uglyninja

jfl
Posts: 226
Joined: 26 Oct 2012 06:40
Location: Saint Hilaire du Touvet, France
Contact:

Re: strange file names

#4 Post by jfl » 21 May 2018 13:25

Assuming everything was done at the command prompt...
The question marks likely mean that the code page and/or the font that you're using in the console do not contain the characters present in these files names.
Try changing to the UTF-8 code page: (Which contains ALL Unicode characters)

Code: Select all

chcp 65001
Also make sure that your console uses a TrueType font with more than the latin characters.
Unfortunately Windows does not provide any console font containing all Unicode characters. You have to make a choice.
I usually use "Liberation Mono" or "Lucida Console", which supports all latin, greek, cyrillic, and hebrew characters.
If your files names are in Arabic, or any non-European script, then you're out of luck.

If you really want to know what these characters are, you can try that:
In my Systems Tools Library, there's a tool called dump.exe.
This tool dumps its input to hexadecimal and ASCII. Ex:

Code: Select all

C:\JFL\Proj\Non-ASCII>chcp 65001
Active code page: 65001

C:\JFL\Proj\Non-ASCII>dir
 Volume in drive C has no label.
 Volume Serial Number is B4F9-E8AF

 Directory of C:\JFL\Proj\Non-ASCII

2018-02-12  17:37    <DIR>          .
2018-02-12  17:37    <DIR>          ..
2017-04-13  18:07    <DIR>          Arabic العربية
2017-04-13  18:07    <DIR>          Chinese 中文
2017-08-17  14:34    <DIR>          Czech Čeština
2017-08-17  14:35    <DIR>          Español Spanish
2017-03-22  23:18    <DIR>          French Français
2017-03-15  21:00    <DIR>          German Deutsch
2017-08-17  14:36    <DIR>          Greek Ελληνικά
2017-04-13  18:08    <DIR>          Hebrew עִבְרִית
2017-08-17  14:37    <DIR>          Hindi हिन्दी
2017-04-13  18:09    <DIR>          Japanese 日本語
2017-08-17  14:37    <DIR>          Korean 한국어
2017-04-13  18:06    <DIR>          Russian Русский
2017-08-18  18:09    <DIR>          Thai ภาษาไทย
2017-03-15  17:13               992 ansi.txt
2017-03-12  13:51               105 README.txt
2018-02-12  17:37             4,937 test.tar.gz
2017-03-15  15:37             1,986 utf16.txt
2017-03-15  17:33             1,251 utf7.txt
2017-03-15  13:14             1,063 utf8.txt
               6 File(s)         10,334 bytes
              15 Dir(s)  151,866,560,512 bytes free

C:\JFL\Proj\Non-ASCII>dir k* | dump

Offset    00           04           08           0C           0   4    8   C
--------  -----------  -----------  -----------  -----------  -------- --------
00000000  20 56 6F 6C  75 6D 65 20  69 6E 20 64  72 69 76 65   Volume  in drive
00000010  20 43 20 68  61 73 20 6E  6F 20 6C 61  62 65 6C 2E   C has n o label.
00000020  0D 0A 20 56  6F 6C 75 6D  65 20 53 65  72 69 61 6C     Volum e Serial
00000030  20 4E 75 6D  62 65 72 20  69 73 20 42  34 46 39 2D   Number  is B4F9-
00000040  45 38 41 46  0D 0A 0D 0A  20 44 69 72  65 63 74 6F  E8AF      Directo
00000050  72 79 20 6F  66 20 43 3A  5C 4A 46 4C  5C 50 72 6F  ry of C: \JFL\Pro
00000060  6A 5C 4E 6F  6E 2D 41 53  43 49 49 0D  0A 0D 0A 32  j\Non-AS CII    2
00000070  30 31 37 2D  30 38 2D 31  37 20 20 31  34 3A 33 37  017-08-1 7  14:37
00000080  20 20 20 20  3C 44 49 52  3E 20 20 20  20 20 20 20      <DIR >
00000090  20 20 20 4B  6F 72 65 61  6E 20 ED 95  9C EA B5 AD     Korea n ������
000000A0  EC 96 B4 0D  0A 20 20 20  20 20 20 20  20 20 20 20  ���
000000B0  20 20 20 20  30 20 46 69  6C 65 28 73  29 20 20 20      0 Fi le(s)
000000C0  20 20 20 20  20 20 20 20  20 20 20 30  20 62 79 74              0 byt
000000D0  65 73 0D 0A  20 20 20 20  20 20 20 20  20 20 20 20  es
000000E0  20 20 20 31  20 44 69 72  28 73 29 20  20 31 35 31     1 Dir (s)  151
000000F0  2C 38 36 36  2C 35 34 34  2C 31 32 38  20 62 79 74  ,866,544 ,128 byt
00000100  65 73 20 66  72 65 65 0D  0A                        es free


C:\JFL\Proj\Non-ASCII>
Note that all characters display correctly in my web browser (Chrome), but only the latin, greek, cyrillic and hebrew ones display in my console. The others display as squares with the font I use.
The above sump shows that the UTF-8 codes for the korean characters that are not displayed correctly in my console are:
ED 95 9C , EA B5 AD , EC 96 B4

kwsiebert
Posts: 42
Joined: 20 Jan 2016 15:46

Re: strange file names

#5 Post by kwsiebert » 22 May 2018 08:49

I've occasionally had to deal with corrupted file names that Windows won't work with. These always come from a RAR archive, and are supposed to be in Japanese, but were created incorrectly (99% of the Japanese files I pull from RARs are fine). WinRAR and 7Zip extract them with no problem, but then Windows can't access them. I've usually had to fix the problem by renaming in for loop.

Post Reply