Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-913

Windows Batch File Fails to Pass More than Eight Arguments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-2
    • 1.0-JSR-4
    • None
    • None
    • Windows XP under cmd, msh, cygwin bash

    Description

      The existing windows .bat file passes command line arguments to groovy with this line (for recent Windows versions, at least):
      set CMD_LINE_ARGS=%1 %2 %3 %4 %5 %6 %7 %8 %9

      Unfortunately, this won't work if your script needs more than eight arguments. Instead, the above line should be replaced with something like the following:

      :set_args_loop
      if "%1"=="" goto after_set_args_loop
      set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
      shift
      goto set_args_loop

      :after_set_args_loop

      Not being a Windows expert myself, there may be a more elegant solution. Then again, .bats ain't elegant. Either way, something should be done to fix this issue... it makes CLI-intensive scripts unusable.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rscharer Ryan Scharer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: