运行BAT / CMD文件与它重音字符 [英] Running BAT/CMD file with accented characters in it

查看:152
本文介绍了运行BAT / CMD文件与它重音字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在其路径中包含重音字符的位置来执行一个EXE文件的指令Windows批处理文件。以下是批处理文件的内容。

 关闭@echo
C:\\西班牙语\\ JRE \\ BIN \\ java.exe的-version

C:\\西班牙语\\ JRE \\ BIN \\ java.exe的 - 这条道路的存在和正确。我可以直接在CMD.EXE运行此命令。但是,当我从一个蝙蝠运行命令/ CMD文件失败说:该系统找不到指定的路径

解决这个问题的方法之一是通过设置code页到1252(即对我的作品)。但恐怕我们不得不设置code页面的任何非英语语言环境,并找出哪些code页面中使用是pretty困难。

是否有其他的方法来解决这个问题?也许一个命令行选项,或者其他什么东西?


解决方案

这样,在Windows中的另一种方式,是使用 wordpad.exe


  

      
  1. 运行 wordpad.exe

  2.   
  3. 写脚本像通常那样,用口音

  4.   
  5. 选择另存为> 其他格式

  6.   
  7. 选择将其保存为文本文档的MS-DOS(* .TXT)

  8.   
  9. 更改文件扩展名从.txt为.bat

  10.   

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:

  1. Run wordpad.exe
  2. Write your script as you usually do, with accents
  3. Choose Save as > Other formats
  4. Choose to save it as Text document MS-DOS (*.txt)
  5. Change the file extension from .txt to .bat

这篇关于运行BAT / CMD文件与它重音字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆