admin管理员组文章数量:1410717
I'm creating a HTA application that needs to open PDF document. I cannot assum that the user will have acrobat installed on his PC as in this example
The WScript (documentation) allow you to run a mand line application. But what I would like, is for the WScript to simulate a double click on the file.
I would like to be able to do something like
var wshShell = new ActiveXObject("WScript.Shell");
wshShell.Exec(pdfFilePath); // That does not work
I'm creating a HTA application that needs to open PDF document. I cannot assum that the user will have acrobat installed on his PC as in this example
The WScript (documentation) allow you to run a mand line application. But what I would like, is for the WScript to simulate a double click on the file.
I would like to be able to do something like
var wshShell = new ActiveXObject("WScript.Shell");
wshShell.Exec(pdfFilePath); // That does not work
Share
Improve this question
edited May 23, 2017 at 12:07
CommunityBot
11 silver badge
asked Aug 11, 2011 at 14:31
David LabergeDavid Laberge
16.1k15 gold badges55 silver badges84 bronze badges
3 Answers
Reset to default 2In cmd
, you can open a file like this: start c:\path\to\file.pdf
Maybe this works
wshShell.Exec("start " & pdfFilePath); //do you do string concat like this in wscript?
If pdfFile contains space, you must be add " and " into start and end of pdfFilePath Change to: wshShell.Run('cmd /C start '+ '\"' + pdfFile + '\"' ,1,false)
The way to do this is:
new ActiveXObject("WScript.Shell").Run(pdfFile,1,false);
本文标签: javascriptHow to open a pdf with WScriptShellStack Overflow
版权声明:本文标题:javascript - How to open a pdf with WScript.Shell - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744799258a2625763.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论