student001 student001 - 10 months ago 121
Bash Question

javascript hta application as GUI for command prompt

I need to create a simple HTA application that will ask for a command, then when I press a button that command should be executed in command prompt.

I have the following script so far which will only open a command prompt window but not read and run the script entered into the text box.



<script type="text/javascript" language="javascript">

function Run() {

x = document.getElementById("command").value;
shell = new ActiveXObject ("Shell.Application");
shell.ShellExecute("cmd.exe", "/k ", "", "open", 1);


<body bgcolor="grey">
<h1> Enter MS-DOS Command </h1>
<p> eg: ipconfig </p>

<textarea cols="20" rows="1" id="command"> </textarea> <br> <br>

<input type="button" value="Run" onclick="Run();">




shell.ShellExecute("cmd.exe", "/k " + x, "", "open", 1);