I've got a TFS project with a 0x96 character in its title, e.g. "Project – X" which I need to reference in a batch file. The problem is that this particular dash is represented by 0x96 (and not 0x20) which is a control character in Unicode (û in ASCII?), so the following (in an ANSI encoded .cmd file) fails as "Project û X".
echo "Project – X"
But when pasted straight to the command line (I think) it cheats and translates the 0x96 to a 0x20 (which is no good as my file names don't match). I tried this with a hex editor and it looks like there's some cheating going on.
The .cmd file won't work if it's encoded as anything but ANSI.
Something like this works
@echo off
SETLOCAL EnableDelayedExpansion
chcp 1252
set "name=Projekt û X.txt"
chcp 850
type "!name!"
The important thing is the chcp 1252, the chcp 850 is only to switch back to my default code page, but it is not neccessary.