如何在Javascript中执行shell命令 [英] How to execute shell command in Javascript

查看:1683
本文介绍了如何在Javascript中执行shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个JavaScript函数来执行系统shell命令(例如 ls )并返回值。

I want to write a JavaScript function which will execute the system shell commands (ls for example) and return the value.

如何实现这一目标?

推荐答案

如果您执行此javascript的客户端运行Windows怎么办?这就是说你想要实现的目标是不可能的。 Javascript是一种客户端脚本语言,通常在Web浏览器中的沙盒环境中运行,阻止它访问计算机上的资源。

What if the client you are executing this javascript is running Windows? This is to say that what you are trying to achieve is not possible. Javascript is a client scripting language and runs in a sandboxed environment often inside a web browser which prevents it from accessing resources on the computer.

这篇关于如何在Javascript中执行shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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