I am trying to have a webpage call a cmd command and execute on the local machine hitting the page and not the web server. Any ideas of how this could be done?
Asked
Active
Viewed 1,215 times
-6
-
1It can't. What would lead you to believe it could be done? – maccettura Jul 26 '17 at 19:30
-
1With immense difficulty as that would effectively be malware to any visitor to such webpage if it were achieved. – Martin Costello Jul 26 '17 at 19:30
-
2What you are asking for is considered a security issue and, when found, are squashed by browser manufacturers almost instantly. – Sam Axe Jul 26 '17 at 19:31
-
1This would require some plugin or component of some kind installed in the browser for the page to trigger. Just imagine a world where any website you visit could arbitrarily execute any command on your computer. – David Jul 26 '17 at 19:32
-
Perhaps you can clarify what you want the command to do on the local machine? You are making some poor assumptions about that OS the browser is running in. – Spevy Jul 26 '17 at 19:34
1 Answers
4
With a generic web page, this is simply not possible, as it would represent a serious security problem.
However if we are talking about an intranet application intended for specific users, you could possibly provide them with a Chrome extension that can shell out a new process. Users would have to install your extension explicitly.
Or if your users all use Internet Explorer, you could potentially develop an ActiveX control that does what you need. Users would need to enable execution of ActiveX controls.
It's not possible with generic HTML and Javascript.

John Wu
- 50,556
- 8
- 44
- 80