0

I'm having a nightmare here, please help.

Here is my JavaScript:

<script language="javascript">
    function MyCmd();
    var shell = new ActiveXObject("Shell.Application");
    var appExe =  @"D:/ping.bat";
    shell.ShellExecute(appExe , "", "", "open", "1");
</script>

I call this function from inside a <td> in a table..

<button style="width:relative; height:65"  onClick="MyCmd()"><b>Netstat</b></button>

All I want is to see the batch file running. Content of the batch file is: netstat > ping.bat, and it's located on d:\. Any ideas?

4
  • What you try is an EXTREME security risk !!! Commented Oct 29, 2011 at 11:10
  • 1
    This will only have a chance to run on IE (other browsers do not support ActiveXObject. Even so, it looks highly dangerous. Commented Oct 29, 2011 at 11:19
  • What makes you think that you could call a server-defined function from the browser? Commented Oct 29, 2011 at 11:24
  • Why would that be a threat if the host is isolated( not connected to internet)? is there a way around this?? Commented Oct 29, 2011 at 12:19

2 Answers 2

2

The code you supplied can only be made to run in Internet Explorer when set to lowest security as well as when UAC is turned off or an OS without UAC is used.

If you intended to get this running on the server, it's probably possible but a completly other question.

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

1 Comment

Hello, is there any way that i can open a program or batch file from asp page! i'm still stuck. security i not an issue on my case!!! please i need ur input
0

Echoing what others have said: this is a terrible idea. Even if you have created something harmless, how is the browser supposed to know that?

I cannot imagine why this is such an emergency. You need to take a step back and think about other ways to do what you want. If you're trying to create a program to execute a batch file, a webpage is a totally inappropriate place for that program.

Comments

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.