Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.