Dos commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cainnech
    New Member
    • Nov 2007
    • 132

    #1

    Dos commands

    Hi guys,

    It's me again :-)

    In Javascript it's perfectly possible to run a file using the Shell.

    But is it also possible to perform multiple tasks but not at the same time?

    So like opening the command and then send a second command that puts the good old Hello World in it. Just to make the test.

    Code:
    var shell=new ActiveXObject("WScript.Shell");
    
    function openconnection()
    {
    shell.Run("cmd /K", 1);
    }
    
    function command()
    {
    shell.Echo("Hello World");
    }
    This was something I tried but I get the error that it can't get the file
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    just a note: fortunatly that is not! possible in JavaScript, it is microsofts JScript and uses ActiveX and relies on a MS-OS at all because of the WSH-usage ... you may only use this with IE and Windows and thats one of the reasons why IE is simply bad! a webapp shouldn't have such privileges because unaware users could be easyly harmed with such possibilities ...

    just my 2 cents ... ;)

    kind regards

    Comment

    • Cainnech
      New Member
      • Nov 2007
      • 132

      #3
      Although I agree with you to a certain extent, I do feel that it could be useful.

      Ofcourse there will always be a risk of people using malicious webapps to do harm to one's pc, but in this case I'm the only user.

      Besides the whole security issue is useless. Or you offer the ability to work with Dos-commands or you don't. But trying to limit it by just authorizing a few commands to be executed isn't going to work.

      If I can't put "format c:" in the function then I can put it in a .bat file and call for the .bat-file. Stays absolutely the same. So trying to limit is just plain stupid.
      My two cents. Thus making 4 cents already ;-)

      But in other words, it's not possible which was my question. Thanks for the reply!

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        i didn't say that something is not possible ... i just said that it is not JavaScript ... it is just MS's use of the WSH and so everything that you might do with that is possible ... and even when it is not with the WSH you just need to write an ActiveX control that could easyly run outside any sandbox of the browser. so just to give a browser the ability to execute something like that is a potential security risk and saying that this is not a problem since only one person uses it is no intelligent argument, because the ability of using that in a harmful way is just given and doesn't make sense for a webbrowser or an application that runs in it ... in case you do an app for your own you could format your drive at your own command-line or use correct admin-tools to do that remote ... but a webapp should never do that and should never has the possibility to do that ... it is a simple idea of trust ... that could be just destroyed by offering such abilities ... and even worse by apps that uses them ...

        ActiveX, WSH, IE have and are serious problems in this regard ...

        Comment

        Working...