在 Windows 上从脚本执行 unicode 命令
我需要在 Windows 上以编程方式执行类似 vlc 舨.avi
的命令。当直接在 cmd.exe 中完成时,效果很好,证明 VLC 具有识别 unicode 参数的能力。但是,我无法将其放入脚本中并使其正常工作。
有人成功做到这一点吗?我很想在 Ruby 中执行此操作(我有 1.9.2),但 Python-win32、Perl-win32、batch、.cmd、VB/W/JScript 都是选项。目标操作系统是 XP 和 Vista。
I need to execute a command like vlc 舨.avi
programatically on Windows. When done directly in cmd.exe this works just fine, proving that VLC has the capability to recognize unicode arguments. However, I'm having trouble putting this in a script and having it work.
Has anyone done this successfully? I would love to do this in Ruby (I have 1.9.2) but Python-win32, Perl-win32, batch, .cmd, VB/W/JScript are all options. Target O/Ses are XP and Vista.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很可能是编码问题。
命令提示符和 Windows 中的编码并不总是相同。如果您的脚本在记事本中,然后执行它,您可能最终会以不同的方式将文件名转换为 unicode,从而出现错误。
不知何故,您必须确保编码正确,也许可以将批处理文件另存为 Unicode 文本文件?那行得通吗?
It's most likely an encoding issue.
Encoding in command prompts and in windows is not always the same. If your script in Notepad, then execute it, you may end up with the filename being converted to unicode differently hence the error.
Somehow, you'll have to make sure that the encoding is correct, maybe by saving you batch file as Unicode text file? Would that work?