How Do I Execute Shelll Commands ? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How Do I Execute Shelll Commands ?

Hello,

I want to execute shell commands(OS commands) from withing JAVASCRIPT, VBSCRIPT, ASP, JSP OR ANY OF THE CLIENT / SERVER SIDE SCRIPTS, is it possible.

For example in VB we can use :

Private Sub Command1_Click()
Shell "c:winnt
otepad"
End Sub


to execute notepad, likewise I want to do in any of the client/server scripts, is it possible.

thanking you.

- srinivasan.


Comments

  • lillulillu Posts: 308Member
    Javascript itself cannot make system calls but if you're running a Windows system, you can insert Windows Script Host in javascript. If you don't like to use WSH use new ActiveXObject(Shell.Application) but there may be some security problems running it properly. (eg. user's broswer's security settings)

    function runApp() {
    var shell = new ActiveXObject("WScript.shell");
    shell.run("notepad.exe");
    }




    : Hello,
    :
    : I want to execute shell commands(OS commands) from withing JAVASCRIPT, VBSCRIPT, ASP, JSP OR ANY OF THE CLIENT / SERVER SIDE SCRIPTS, is it possible.
    :
    : For example in VB we can use :
    :
    : Private Sub Command1_Click()
    : Shell "c:winnt
    otepad"
    : End Sub
    :
    :
    : to execute notepad, likewise I want to do in any of the client/server scripts, is it possible.
    :
    : thanking you.
    :
    : - srinivasan.
    :
    :
    :

    [hr][grey]To err is human, but to really foul things up requires a computer. (Farmers Almanac)[/grey] :-)

Sign In or Register to comment.