How to execute parameterized command using java script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rahuljaiswal1987
    New Member
    • Apr 2010
    • 23

    How to execute parameterized command using java script?

    Videoagent.exe -s 100.100.10.1 -c 3 -d 08252002 -b 14:12:35 -e 14:15:12 -u USERID -p PASSWORD


    This is a command to execute video agent with these parameter. I want to execute this command through javascript. Tell me some solution if you have.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I have none and I will never have. JavaScript cannot get out of its browser sandbox.

    Comment

    • rahuljaiswal1987
      New Member
      • Apr 2010
      • 23

      #3
      I have got the soln.


      Code:
      var oShell = new ActiveXObject("Shell.Application");
      var commandtoRun = "C:\\Program Files\\Sensormatic\\NetworkClient\\Bin\\VideoAgent.exe";
      var commandParms = "-s 0.0.0.0 -t 5000 -c 5 -d 04042010 -b 14:12:35 -e 14:15:12";
      oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");


      rEGARDS,

      rAHUL
      Last edited by Dormilich; Apr 8 '10, 08:47 AM. Reason: Please use [code] tags when posting code

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        that will only work in IE.

        Comment

        • rahuljaiswal1987
          New Member
          • Apr 2010
          • 23

          #5
          I know but is thr any way so that it can work for other browsers too.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            nope. that would be too high a security risk.

            Comment

            • rahuljaiswal1987
              New Member
              • Apr 2010
              • 23

              #7
              Is there any alternative to ShellExecute() method?

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                as I already said, JavaScript (unlike JScript) does not have any access to the local file system.

                Comment

                • rahuljaiswal1987
                  New Member
                  • Apr 2010
                  • 23

                  #9
                  I don't know at this time that whetjer its possible or not, but i totally disagree with your 2nd statement that "JavaScript does not have any access to the local file system."

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #10
                    Originally posted by rahuljaiswal198 7
                    but i m totally disagree with ur 2nd statement that "JavaScript does not have any access to the local file system."
                    that’s your opinion. but don’t complain, if you should fail afterwards.

                    Comment

                    • rahuljaiswal1987
                      New Member
                      • Apr 2010
                      • 23

                      #11
                      its not ma openion its fact. nd i'll neve fail.

                      Comment

                      • rahuljaiswal1987
                        New Member
                        • Apr 2010
                        • 23

                        #12
                        Try this link:

                        download and use it.

                        Comment

                        • Dormilich
                          Recognized Expert Expert
                          • Aug 2008
                          • 8694

                          #13
                          *lol*

                          that’s not JavaScript and, if you didn’t notice, it’s Windows only.

                          Comment

                          • PandiarajanChellappan
                            New Member
                            • Apr 2010
                            • 7

                            #14
                            If u want to execute this in mozilla then try this. In address bar, type:
                            about:config

                            It list lot of configs, from those select
                            signed.applets. codebase_princi pal_support
                            change its value as true

                            Then execute the script. I am not sure but try this.

                            Comment

                            • rahuljaiswal1987
                              New Member
                              • Apr 2010
                              • 23

                              #15
                              Still its not workin but thanks for your reply Pandian.

                              Comment

                              Working...