I cannot access to path strings that I query from the registry in Windows XP command line if they contain accented characters.
for /f "tokens=4*" %a in ('reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Common Start Menu" ^| find /i "Common Start Menu"') do set test=%b
echo %test%
In Spanish OS, this code is returning:
%ALLUSERSPROFILE%\Men· Inicio
Where "·" should be an "ú", so I can't work with that path, for example if I try to change actual directory to it...
cd %test%
I end up getting a "the system cannot find the path specified" error. I tried switching between code pages (chcp) but can't figure this out.
Try next code snippet:
@echo off
setlocal ENABLEDELAYEDEXPANSION
MODE CON CP SELECT=1250 > NUL
for /f "tokens=4*" %%a in ('reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Common Start Menu" ^| find /i "Common Start Menu"') do set test=%%b
MODE CON CP SELECT=852 > NUL
set xest=!test:%%allusersprofile%%=%allusersprofile%!
@echo "%xest%"
@dir /AD "%xest%"
endlocal
As I'm on Czech windows, you should modify code pages in both the MODE CON CP SELECT=xxx
commands to your locale. For your information: 1250=Windows ANSI Central Europe, 852=OEM Central Europe; I guess your ones could be 1252 (ANSI Latin 1; Western European for Windows) and 850 (OEM Multilingual Latin 1; Western European for DOS), respectively.