K2teknik Posted February 10, 2012 Share Posted February 10, 2012 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 More sharing options...
Yzöwl Posted February 10, 2012 Share Posted February 10, 2012 Can you start the script from the command line using your folder as a parameter?MyBatch.cmd C:\æøå@ECHO OFF & SETLOCAL ENABLEEXTENSIONSFOR /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 ENABLEEXTENSIONSIF EXIST "C:\‘›†\START.EXE" "C:\‘›†\START.EXE"but it should be correct! Link to comment Share on other sites More sharing options...
allen2 Posted February 10, 2012 Share Posted February 10, 2012 (edited) 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. Edited February 10, 2012 by allen2 Link to comment Share on other sites More sharing options...
Joseph_sw Posted February 10, 2012 Share Posted February 10, 2012 you can also use: dir /x on parent folder to determine the actual 8.3 folder names, and use such name in your batch. Link to comment Share on other sites More sharing options...
cdob Posted February 12, 2012 Share Posted February 12, 2012 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 exampleset CodePage=HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePageFOR /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.comdir 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now