Posts

Showing posts from October, 2011

CHCP – DOS Special Character Problems (CMD Active Codes)

Another “very hard to find” tip… When writing batch files with some special characters like “é” or “à”, you might have surprise errors. Running batch files, with special characters in the code, can cause some serious interpretation problems and your commands might not work at all. Sometimes, you can’t avoid using these characters, like in my case. Because I live in Montréal, Québec (French part of Canada) and there are serious law issues that we have to respect and I think the most difficult part of my job is this language issue. The trick is hidden in this link from Microsoft; http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/chcp.mspx?mfr=true The « chcp » command displays or sets the active code page number is the remedy to your problem. By putting the “chcp 1252” at the beginning of your code, you are changing the “active code” for your cmd environment before even executing your commands in the batch file. The number 1252 is the code