I have a strange problem, I want to start a program from a cmd file, it should be easy, but when the path contains non latin letters then things go wrong.
My program is in a folder "c:\æøå" and the program is called "start.exe"
from the command promt I can just type in "c:\æøå\start.exe" and things works ok.
But if I make a cmd file with the same line "c:\æøå\start.exe" then the line is converted when the script is executed into "c:\µ°Õ\start.exe" and that path(folder) do not exist, so no start of my program.
I had try to save my cmd file in unicode/UTF8 but that does not work at all.
What to do ?
Page 1 of 1
Non Latin letters in path Or unicode support in cmd script
#2
Posted 10 February 2012 - 07:04 AM
Can you start the script from the command line using your folder as a parameter?
If that is not an option, another is to use 'Terminal' font in your batch script editor.
It may look like this in another font/editor
MyBatch.cmd C:\æøå
@ECHO OFF & SETLOCAL ENABLEEXTENSIONS
FOR /F "TOKENS=*" %%# IN ("%*") DO (SET _=%%~#)
IF EXIST "%_%\START.EXE" "%_%\START.EXE"
If that is not an option, another is to use 'Terminal' font in your batch script editor.
It may look like this in another font/editor
@ECHO OFF & SETLOCAL ENABLEEXTENSIONS IF EXIST "C:\‘›†\START.EXE" "C:\‘›†\START.EXE"but it should be correct!
#3
Posted 10 February 2012 - 08:53 AM
When i have this kind of problem with only 2 or 3 occurrences i use the good old edit from a dos prompt and type wanted text/characters.
This post has been edited by allen2: 10 February 2012 - 08:54 AM
#4
Posted 10 February 2012 - 10:37 AM
you can also use: dir /x
on parent folder to determine the actual 8.3 folder names, and use such name in your batch.
on parent folder to determine the actual 8.3 folder names, and use such name in your batch.
#5
Posted 12 February 2012 - 11:18 AM
K2teknik, on 10 February 2012 - 06:09 AM, said:
My program is in a folder "c:\æøå" and the program is called "start.exe"
from the command promt I can just type in "c:\æøå\start.exe" and things works ok.
from the command promt I can just type in "c:\æøå\start.exe" and things works ok.
It's about ANSI and OEM codepages.
CMD file uses ANSI codepage and command line uses OEM codepage.
Adjust codepage.
Try a example
set CodePage=HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage
FOR /F "tokens=1-2*" %%a IN ('%SystemRoot%\system32\reg.exe query "%CodePage%" /v "OEMCP"') DO (set OEMCP=%%c)
FOR /F "tokens=1-2*" %%a IN ('%SystemRoot%\system32\reg.exe query "%CodePage%" /v "ACP"') DO (set ACP=%%c)
echo current CodePage
%SystemRoot%\system32\chcp.com
dir c:\æøå
echo set CodePage to %ACP%
%SystemRoot%\system32\chcp.com %ACP%
dir c:\æøå
echo set CodePage to %OEMCP%
%SystemRoot%\system32\chcp.com %OEMCP%
- ← KB2657424 for .NET Framework 3.5 being offered when only .NET 2.0 inst
- Windows XP
- Questions Regarding SFC →
Share this topic:
Page 1 of 1



Help
Back to top










