0

I want to execute sample.bat file locally from HTML/ Javascript

sample.bat:

start /d "\\server\Software\" sample.exe

In IE it working using ActiveXObject but it shows a popup like run/Discard

I don't want to come any popup when i lick on a button the bat file should run and execute the specified file

5
  • by webserver only ) Commented Sep 28, 2016 at 12:00
  • I suppose you mean HTML in a browser and not Node.js or other similar engines. And I understand you already know how to do it, but you want to skip the user consent. Am I correct so far? If so, you might get better answers if you explain your context and your ultimate goal (rather than just the solution you've figured out). Commented Sep 28, 2016 at 12:12
  • Maybe you can find plugins that allow a JS to run a command, but that would be damn dangerous. Commented Sep 28, 2016 at 14:59
  • @Xenos that is not possible. Javascript cannot execute commands outside of the browser. Commented Oct 4, 2016 at 12:46
  • @RobLang "plugins that allow" As long as a plugin is involved, you can do anything (as long as it is allowed by browser's plugin policy). See stackoverflow.com/questions/11527128/… Commented Oct 5, 2016 at 12:29

1 Answer 1

3

You cannot run a .bat file from within the sandbox of the browser. ActiveXObjects will run in IE only and are regarded as a huge security hazard.

It is also not possible to run any command line from within a webpage. I would always suggest against this as a tactic.

Perhaps you might get a better answer if you explain what it is you're trying to achieve rather than the solution.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank for the response Rob, Actually I tried ActiveXObject in IE only. I will explain what I was trying for, I have a .bat file inside the file I wrote "start /d "\\server\Software\" putty.exe" to install/run putty. I just want to execute this from client side. is it possible Rob ?
Rob, Please share your thoughts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.