Click to See Complete Forum and Search --> : Help - Running Shell Commands from HTML Doc.


Rafique
02-14-2003, 09:02 AM
HELP !!!!

Just Beginning to get into Javascript and HTML.

Need to know how to do the following:

I am trying to do the following through my html document.
I need to be able to execute a shell command eg: 'notepad.exe' when a user presses a command button on a Html document.

This may seem like a very basic request , but humble ol' me would appreciate any help at this point..

cheers......

khalidali63
02-14-2003, 11:14 AM
I hope this helps,take a look at this thread

http://forums.webdeveloper.com/showthread.php?s=&threadid=2189

towards the end of the thread I posted an answer for this problem.

cheers

Khalid

LAwebTek
02-14-2003, 01:21 PM
<html>
<head>
<script language="JavaScript" type="text/javascript">
function executeCommands(inputparms)
{
/* Instantiate the Shell object and invoke its execute method.*/

var oShell = new ActiveXObject("Shell.Application");

var commandtoRun = "C:\\WINDOWS\\NOTEPAD.EXE";
if (inputparms != "")
{
var commandParms = document.form.filename.value;
}

/* Invoke the execute method. */
oShell.ShellExecute(commandtoRun, commandParms,
"", "open", "1");
}
</script>
</head>
<body>
<Input type="hidden" name="filename" />
<input type="button" value="NotePad" onClick="executeCommands(' + hasPARMS + ')" />
</body>
</html>

Rafique
02-17-2003, 03:43 AM
Thanx for the help with running the sheel command in html guys ...
Really got me out of a sticky situation ...

newhere
11-28-2011, 04:03 PM
I hope you don't mind necroposting but I would like to know if this code is thought to work after all. (Yes, it doesn't run on my machine.) If the code is outdated what needs to be changed to make it work again under windows 7 + firefox 8 ? Please reply if you know something about this.