Changing the code page in a .bat file (Win7 vs Win Vista)

I have a strange problem while trying to change the code page in a .bat file.

When I run the following .bat file on Windows 7, it works fine.

The code page is modified and program.exeexecuted.

Batch file:

chcp 65001

"D:\program.exe" /opt ÄiÜ

pause

However, when I run the .bat file from Windows Vista, the code page changes and a batch file is issued after that.

That program.exewill never be done. However, when I run two commands manually from the command line, it works.

Any idea how to make this work under Windows Vista from a .bat file?

+5
source share
4 answers

( ) , .

, .

, , :

  • , , .txt( , ).
  • #, TXT .

, , .

, .

0

, Win7, Vista XP , , 65001.

workaraound

(
  chcp 65001
  cmd /c type myFile.txt
  chcp 850
)
echo the batch is still alive

, .

( ) 1252

chcp 1252
echo ÄÖÜß
+1

chcp (chcp 65001 & echo %ERRORLEVEL%)?

, chcp 65001 & "D:\program.exe" /opt ÄiÜ & chcp 850.

0

, , :

  • dir txt (dir c:\_ > diroutput.txt)
  • diroutput.txt , ( , )
  • , .

If you select the contents of the batch file in the dos window (enter batchfilename.bat), you will see that the file name is correct. (It will also look correct in totalcommander built into fileviewer, but it will look like garbage in notepad)

0
source

All Articles