I am trying to open a telnet window and send some keys to this active window. Below is the JavaScript code:
var oWshShell = new ActiveXObject("WScript.Shell");
oWshShell.Run("telnet 43.43.22.45 23");
//oWshShell.Run("firefox.exe http://www.google.com");
//oWshShell.Run(" notepad.exe");
oWshShell = null;
But I am unable to open them all the same. It says the file does not exist. However, the commented lines work perfectly, when uncommented. what could be the problem?
Thanks in advance.
@Avi, I dont't think you'll be able to execute this type of command when a page loads unless you use Internet Explorer and enable full trust security. If you must do this way, though, you just have to specify the full path to telnet.exe
. Just beware that windows uses \
to separate the directory levels, but this is a special character to javascript, and it must be escaped; i.e:
var path = "c:\\Windows\\System32"; // this is c:\Windows\System32 in javascript
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With