WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: DGOODALE on October 18, 2021, 11:45:18 AM

Title: Large String
Post by: DGOODALE on October 18, 2021, 11:45:18 AM
Is there any way around the 2048 char limit of a string?  I'm bumping up a 3101 error when trying to create a string to build a command line.
cmd='"D:\ps\%script%" -CN "%subjname%" -SAN "DNS=%subjname%","DNS=%sans%" -CAName "<hostname>\<CA Name>" -Verbose'

The variable in the mix is %sans% which could have from 1 to 40 fqdn hostnames which could throw the total char count > 2048
Title: Re: Large String
Post by: td on October 18, 2021, 12:20:25 PM
This is an easy one. Don't use substitution. Use the StrCat function instead.
Title: Re: Large String
Post by: DGOODALE on October 18, 2021, 02:31:32 PM
Perfect.  Worked like it should.
Title: Re: Large String
Post by: td on October 18, 2021, 03:06:00 PM
You can also use the concatenation operator which is a colon. It works just like StrCat but seems to take some users a bit of getting used to.