Kvc wrote:The valid length of the String saved in a variable is 8177 characters.
Not quite.
As I wrote - the maximum string length is 8191 characters (for a confirmation see the Microsoft link I posted). But string length doesnt mean that you can save 8191 characters in a variable because also the assignment belongs to the string. In my example you can save 8189 characters because the remaining 2 characters are needed for "a=". Thus, the maximum content of your variable is getting shorter for a longer variable name. And because your call of Getlen results in longer strings you can't even use the length that is theoretically possibel.
Kvc wrote:I didn't understood the 32 KBs block concept.
There is nothing to understand because that's set by Microsoft and thus, a limitation on Windows. And as tests show - the more content you have in the environment (and all Batch variable are environment variables) the slower becomes the execution of your script.
Typical example where Batch is doomed to failure: Trying to process markup like XML or HTML.
- it is most likely saved in a charset other than the OEM code page that batch uses
- the line length isn't limited; theoretically you can save the whole HTML or XML content in only one line
Another example: Trying to save the whole content of a file in memory.
Often people try to to read the content of a file linewise and save it in umpteen variables of an assoziative array (line_1, line_2, ...). Whenever possible, only save one line and directly process this line! It doesn't make sense to iterate over the file content to save an array only to iterate over the array afterwards.
Steffen