Running telnet.exe from Internet Explorer
Today I had the task to launch a telnet session within a web page. Not to hard, I thought, when using IE. But as usual: it was harded than expected.
The challenge is to run it on x86 and x64 version of Windows. Here is my code:
function launchTelnet(address) {
if (window.navigator.userAgent.indexOf("WOW64") == -1) {
var commandtoRun = "C:\\Windows\\system32\\telnet.exe";
var oShell = new ActiveXObject("Shell.Application");
oShell.ShellExecute(commandtoRun, address, "", "open", "1");
} else {
var commandtoRun = "C:\\Windows\\sysnative\\telnet.exe";
var oShell = new ActiveXObject("Shell.Application");
oShell.ShellExecute(commandtoRun, address, "", "open", "1");
}
return true;
}