如何使用javascript而不是使用html + JS来运行.exe文件 [英] how to run an .exe file using only javascript not using html+JS

查看:126
本文介绍了如何使用javascript而不是使用html + JS来运行.exe文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用ide中的javascript代码运行我桌面上的.exe文件。

I need to run an .exe file present on my desktop using only javascript code in an ide.

推荐答案

我假设您正在谈论JavaScript作为浏览器中的网页......

这是不可能的,而且有充分的理由! JavaScript本身没有IO功能,网页在浏览器中运行,他们称之为沙盒 - 一个孤立的环境...

这一切都是为了提高安全性 - 毕竟,你不希望这样您访问的每个站点都可以在您的计算机上运行任何可执行文件...
I assume you are talking about JavaScript as part of a web page inside a browser...
It is not possible and for good reasons! JavaScript itself has no IO capabilities and web page runs inside a browser in what they called 'sandbox' - an isolated environment...
All this for improved security - you, after all, do not want that every site you visit will be able to run any executable on your computer when wishes so...


这取决于用于执行您的javascript的VM的限制。浏览器VM是沙盒。



但是如果你使用Node.js来运行你的代码。这确实允许您启动流程:



http://stackoverflow.com/questions/5775088/is-it-possible-to-execute-an-external-program-from-within-node- js [ ^ ]
It depends on the limitation of the VM being using to execute your javascript. Browser VM's are sandboxed.

But if you use Node.js to run your code. This does allow you to launch processes:

http://stackoverflow.com/questions/5775088/is-it-possible-to-execute-an-external-program-from-within-node-js[^]


这篇关于如何使用javascript而不是使用html + JS来运行.exe文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆