当前位置: 代码迷 >> Java Web开发 >> js本地运行exe时 因为路径有空格 找不到文件路径,该怎么解决
  详细解决方案

js本地运行exe时 因为路径有空格 找不到文件路径,该怎么解决

热度:90   发布时间:2016-04-17 12:44:46.0
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");
  相关解决方案