extended characters in batch file

Microsoft Windows xp professional w/serv...
December 2, 2009 at 14:21:24
Specs: Windows XP, Phenom II/4GB
I am trying to rename files in a batch.
But I want to use special characters in the file name like these ==> ♥♦♣♠
ascii code 3,4,5 and 6
Is there a way to insert these into a file name using batch commands?
Perhaps using a function that translates ascii code to a character?

See More: extended characters in batch file

Report •

December 2, 2009 at 14:34:02

You have to do it at the Command Prompt. Strat -> Run -> Type CMD.

Once in the command prompt navigate to the directory your file is stored in.


RN oldfile.txt ♥♀δΩ.txt

To make them, Hold down the Alt key and type the decimal code on the number pad of your key board and release the Alt key. It will not work with the numbers above only with the number pad on the right of the key board.

By the way I tried this in Vista and you can now use special characters when using rename in it.

Report •

December 2, 2009 at 14:52:18
You got me to playing with this and I found a new Exploit in Windows. If you want to create a folder that no one can delete or rename make a new folder then rename it to a ALT+255 character then the folder becomes unrenameable and undelteable. You can delete it at a DOS prompt if you do a

RD " "

Kinda cool.

Report •

December 2, 2009 at 15:14:47
thank you for trying to answer my question, but you misunderstand what I am asking.

I would like to know how to rename files *from within a batch file*. Batch files cannot use unicode apparently. so that makes it very tough.

Report •

Related Solutions

December 2, 2009 at 15:45:38
This didn't work at the prompt:

type nul > "[alt-3]"

so I think you're out of luck.

As for the alleged exploit, in w2k you can delete a file named [alt-255].

Helping others achieve escape felicity


Report •

December 2, 2009 at 20:05:16
my system doesn't have "RN" command. i tried ren, copy, and move and got "filename, dirname .. syntax incorrect" from the command prompt when using ctrl chars (d,e,f).
batchfile can get control-chars from another file by reading it in. debug can be used to to create the control char.s file:

echo f100,104,04,06,05,03 > debgpipe
echo rcx >> debgpipe
echo 4 >> debgpipe
echo w >> debgpipe
echo q >> debgpipe
debug chars < debgpipe

for /f "tokens=* delims=" %%a in (chars) do (
rn afile.txt %%a)

admittedly very convoluted and awkward way to get ctrl chars into the batch environment, but if "rn" will do the renaming using controlchars, the rest can be figured out, although it will be a challenge!

Report •

December 3, 2009 at 04:01:29
Hi nbrane,

I'd never have thought of using fill. I'd do it this way:

>> #.d echo e 100 3 4 5 6
>> #.d echo rcx

But hey, it works.

Helping others achieve escape felicity


Report •

Ask Question