日期:2014-05-18  浏览次数:20611 次

js本地运行exe时 因为路径有空格 找不到文件路径
jsp文件如下 


<%@ page contentType="text/html;charset=gb2312"% > 

<html >  
<body >  
<script language="javascript" >  
  


new ActiveXObject("Wscript.Shell").run("F:\\ProgramFiles\\Foxit Reader\\Foxit Reader.exe");  

</script >  
</body >  
</html > 


但是因为 路径中 Foxit Reader有空格 所以他运行找不到 这个exe文件 如果换一个路径中间没有空格的 就可以找到并运行exe

------解决方案--------------------
对空格进行编码 ,编成%20就可以了
new ActiveXObject("Wscript.Shell").run("file:///D:\\Program%20Files\\Tencent\\TM2\\TMShell.exe");