为了账号安全,请及时绑定邮箱和手机立即绑定

如何在批处理文件中转出“&”号?

如何在批处理文件中转出“&”号?

明月笑刀无情 2019-10-18 13:59:47
我如何在批处理文件中(或从Windows命令行)转义“&”符号,以便使用该start命令打开URL中带有“&”符号的网页?双引号不能使用start; 这将启动一个新的命令行窗口。更新1:Wael Dalloul的解决方案有效。另外,如果URL中有URL编码的字符(例如,空格编码为%20)并且在批处理文件中,则必须将“%”编码为“ %%”。在示例中不是这种情况。例如,从命令行(CMD.EXE):start http://www.google.com/search?client=opera&rls=en&q=escape+ampersand&sourceid=opera&ie=utf-8&oe=utf-8将导致http://www.google.com/search?client=opera 在默认浏览器中打开,并且在命令行窗口中出现以下错误:'rls' is not recognized as an internal or external command,operable program or batch file.'q' is not recognized as an internal or external command,operable program or batch file.'sourceid' is not recognized as an internal or external command,operable program or batch file.'ie' is not recognized as an internal or external command,operable program or batch file.'oe' is not recognized as an internal or external command,operable program or batch file.平台:Windows XP 64位SP2。
查看完整描述

3 回答

?
呼啦一阵风

TA贡献1802条经验 获得超6个赞

&用于分隔命令。因此,您可以使用^来逃脱&


查看完整回答
反对 回复 2019-10-18
  • 3 回答
  • 0 关注
  • 590 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信