Jump to content

Non Latin letters in path


K2teknik

Recommended Posts

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 ?

Link to comment
Share on other sites


Can you start the script from the command line using your folder as a parameter?

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!

Link to comment
Share on other sites

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.

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%

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...