I have a Windows batch file which has an instruction to execute an EXE file in a location whose path contains accented characters. Following are the contents of the batch file.
@echo off
C:\español\jre\bin\java.exe -version
C:\español\jre\bin\java.exe - This path exists and is proper. I can run this command directly on cmd.exe. But when I run the command from a bat/cmd file it fails saying "The system cannot find the path specified"
One way to fix this is by setting code page to 1252 (that works for me). But I'm afraid we'd have to set code pages for any non-English locale and figuring out which code page to use is pretty difficult.
Is there an alternative approach to fix this problem? Maybe a command-line option or something else?
Another way of doing this, in Windows, is by using wordpad.exe:
- Run wordpad.exe
- Write your script as you usually do, with accents
- Choose Save as > Other formats
- Choose to save it as Text document MS-DOS (*.txt)
- Change the file extension from .txt to .bat