2 Replies Latest reply: May 10, 2012 3:12 AM by gimbal2 RSS

    Simulating manual Cmd prompt calls

    936281
      Hi,

      We need to create a tool that simulates commands provided from cmd prompt. We currenly run various commands in a sequence from cmd prompt-

      Example:
      command1 :
      input -
      c:\ command1 prepare
      output -
      c:\ command1 successful
      End of command1

      command2 :
      input -
      c:\ command2 fetch
      End of command2
      This launces a new cmd prompt window

      command3 : (In new cmd prompt window)
      input -
      c:\ command3 launch
      output -
      c:\ command3 successful
      End of command3

      In case there is any error in any stage, we stop moving to the next command. These commands are Perl based and present in the path env-variable; hence can be run directly from cmd prompt. Plan is to keep the input commands and the expected output in a xml file - fire the input command and compare the actual output with the expected output in XML file. In case of match, move to next command in the sequence present in the XML file.

      Is Java the best option in this scenario? If we have this made as platform independent, it would be an added advantage. Is there any Java API / tool present for this - I' am aware of Runtime and ProcessBuilder; however they appear slightly tedious to use and test. Any suggenstion would be highly appreciated.

      Thanks,
      Jay
        • 1. Re: Simulating manual Cmd prompt calls
          TPD-Opitz
          Welcome to the forum.
          user9511345 wrote:
          We need to create a tool that simulates commands provided from cmd prompt. We currenly run various commands in a sequence from cmd prompt- [...]
          These commands are Perl based [...]
          Is Java the best option in this scenario? [...]
          I'd say no.
          <ol><li>This is a typical scripting task and java is not a scripting language.</li>
          <li>Perl is a scripting language in the first place.</li>
          <li>There is some pearl knowledge already around you.</li></ol>
          Cobbler, stick to your last!

          bye
          TPD
          • 2. Re: Simulating manual Cmd prompt calls
            gimbal2
            T.PD wrote:
            Welcome to the forum.
            user9511345 wrote:
            We need to create a tool that simulates commands provided from cmd prompt. We currenly run various commands in a sequence from cmd prompt- [...]
            These commands are Perl based [...]
            Is Java the best option in this scenario? [...]
            I'd say no.
            <ol><li>This is a typical scripting task and java is not a scripting language.</li>
            <li>Perl is a scripting language in the first place.</li>
            <li>There is some pearl knowledge already around you.</li></ol>
            Cobbler, stick to your last!

            bye
            TPD
            Agreed. It seems very odd to swap out a programming language you already know for one you don't know. If it is related to "Java is platform independent" deal - that's only because Oracle provides an OS specific runtime for most popular platforms (which you still have to install on all machines where you want this tool to run). Correct me if I'm wrong, but I do believe that the perl interpreter is available for multiple platforms as well.