使用百分号(%)作为CMD参数将被解释为变量

时间:2013-01-17 21:49:29

标签: command-line cmd command-line-arguments wget

我尝试使用以下代码运行批处理文件:

wget.exe "http://example.com/file0%24.html"

问题是,CMD将%2解释为变量(第二个命令行参数),因为它没有定义,所以它是空的。

有解决方法吗?

2 个答案:

答案 0 :(得分:4)

使用双百分号发送百分比文字。

wget.exe "http://example.com/file0%%24.html"

答案 1 :(得分:2)

您可以将%转义为%%

  

wget.exe“http://example.com/file0%%24.html”

http://support.microsoft.com/kb/75634