viewpoint-particle

Author Topic: Large String  (Read 83 times)

DGOODALE

  • Newbie
  • *
  • Posts: 4
Large String
« 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

td

  • Tech Support
  • *****
  • Posts: 3952
    • WinBatch
Re: Large String
« Reply #1 on: October 18, 2021, 12:20:25 pm »
This is an easy one. Don't use substitution. Use the StrCat function instead.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

DGOODALE

  • Newbie
  • *
  • Posts: 4
Re: Large String
« Reply #2 on: October 18, 2021, 02:31:32 pm »
Perfect.  Worked like it should.

td

  • Tech Support
  • *****
  • Posts: 3952
    • WinBatch
Re: Large String
« Reply #3 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.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade