1

How can I run shell command in javascript in code behind

I have this exe file on:

C:\Program Files\test.exe

that i want to run using javascript and I want to do it in codebehind or at least call this function from code behind.

The reason want to do it on code behind is that I have parameters need to pass them in the shell command.

1 Answer 1

1

For security reasons you can not run commands from JavaScript.

If you are using JScript, then

var shell = WScript.CreateObject("WScript.Shell");
shell.Run("command here");
Sign up to request clarification or add additional context in comments.

5 Comments

what is WScript? do I need to reference anything? I need to put it in: <script type="text/javascript" language="javascript">
<script type="text/javascript" language="javascript"> function runDataReader(strpath) { var shell = WScript.CreateObject("WScript.Shell"); shell.Run(strpath); } </script>
I guess you are happy with my answer then
how is that possible in linux?

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.