0

I need your help for a batch file that I am trying to develop in a windows environment.

I have a string that contains a set of parameters split up by a hyphen like this:

     rossi-mario-rome-01031998

I need to check if the length of each of these 3 parameters doesn't exceed the maximum value defined in an array like this:

     set /a arraylen[1]=30
     set /a arraylen[2]=30
     set /a arraylen[3]=20
     set /a arraylen[4]=8

In case of the parameter's length exceeds the value defined in the array, a variable should be set to 1 and the script should be ended.

Please, can you help to develop such a script?

aschipfl
  • 33,626
  • 12
  • 54
  • 99
bantonacci
  • 29
  • 3
  • 1
    We can help you to develop the script, supposing you share what you have already; but we are not going to do your work for free. Please read the help: [What topics can I ask about here?](http://stackoverflow.com/help/on-topic) and [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask) – aschipfl Jun 08 '16 at 16:55
  • [hint](http://ss64.com/nt/for_f.html) and [hint](http://stackoverflow.com/questions/37525639/bat-messure-file-path-length-and-put-it-in-a-txt-file) – Dennis van Gils Jun 08 '16 at 17:28
  • [strlen](http://ss64.org/viewtopic.php?pid=6478) – npocmaka Jun 08 '16 at 17:53
  • @npocmaka as this is about **maximum** string length rather that string length in general I feel like the answer given by Stephan [here](http://stackoverflow.com/a/37526214/5022761) is less complicated. – Dennis van Gils Jun 08 '16 at 19:29

0 Answers0