troubleshooting Question

open a command prompt with javascript or vbscript

Avatar of WMIF
WMIF asked on
Web DevelopmentWindows Batch
7 Comments1 Solution24964 ViewsLast Modified:
this is for use internally so whatever security issues are not a problem.  i just need to know what to setup to make it work.  i would like to be able to click on a link, or button or something and have that bring up the same window that would come up if you went to start > run and type cmd.  i found a couple examples for javascript and vbscript, but they dont seem to be working properly.

vbscript:
<script language="VBScript">
function pingIt(ipAddress)
      set WshShell = CreateObject("WScript.Shell")
      WshShell.Run("cmd.exe /k ping " & ipAddress)
end function
</script>
trying to call with:
<div onclick="call pingIt('172.17.100.3')">ping</div>

i get an error saying "activex component cant create object: 'wscript.shell'"


javascript example:
<script type="text/javascript" language="javascript">
function pingItjs(ipAddress) {
      var oShell = new ActiveXObject("wscript.shell");
      oShell.Run("cmd.exe /k ping" + ipAddress);
      
}
</script>
calling it with:
<a href="javascript:pingItjs('172.17.100.3')">ping</a>

but this gives me an error: "automation server cant create object"


please fix my code or direct me to an example that will work for this.  this for only 2 client machines to use on an intranet so setting up security settings is not a problem.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros