running cmd line using javacript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • henmar
    New Member
    • Aug 2010
    • 4

    #1

    running cmd line using javacript

    I need to run a command to open a windows application using javascript. And I am using below line of code:
    Code:
    WshShell = new ActiveXObject("WScript.Shell");
    WshShell.Run (cmd,0,true);
    I execute the cmd and opens the application but the problem is it displays ActiveX warning message and also it doesn't return any value to verify if it was able to execute the cmd successfully.
    Please suggest some solution to disable ActiveX warning message using javascript in client machine. And also like to know if there is any other way/fucntion without using ActiveXObject() .
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    you cannot modify ActiveX settings of the browser with javascript - this would be a massive security issue, not at least since ActiveX has some noteworthy security issues itself. imagine a webpage that would execute such things at your machine without notifying you. in case it is a intranet app, then you could manage to set the ActiveX settings in the clients browsers - but that would be an administrative task.

    Comment

    • henmar
      New Member
      • Aug 2010
      • 4

      #3
      Originally posted by gits
      you cannot modify ActiveX settings of the browser with javascript - this would be a massive security issue, not at least since ActiveX has some noteworthy security issues itself. imagine a webpage that would execute such things at your machine without notifying you. in case it is a intranet app, then you could manage to set the ActiveX settings in the clients browsers - but that would be an administrative task.
      Thanks gits!

      Is there any workaround and avoid using activeX.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        that depends on the command that you want to have executed ...

        Comment

        • henmar
          New Member
          • Aug 2010
          • 4

          #5
          Originally posted by gits
          that depends on the command that you want to have executed ...
          Below lines open a notepad:
          var WshShell = new ActiveXObject(" WScript.Shell")
          WshShell.Run("c md /C notepad", 1, true)
          I just want to open an application that allows user to install softwares remotely in place of notepad.

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            i guess then you are out of luck without ActiveX. this will even work with IE only ... so personally i would just let the user download the file and install it for him-/herself ... it would just be a fiddling with uncontrollable settings to create a unreliable install method.

            Comment

            • henmar
              New Member
              • Aug 2010
              • 4

              #7
              thanks gits, i appreciate it!
              I guess i am out of luck.....i even tried creating a HTA and then opening the HTA using window.open(), it again ask user to open or save the application.... ......i guess i just have to put the cmd in a batch file and ask user to dowload and run the cmd.
              Thanks again!

              Comment

              Working...