Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 

tomasz86

How to get around the 2047 characters CMD string limitation

Recommended Posts

allen2    1

Never needed to use this means but if you go this way then you could also use something like the method used by Herbert Kleebauer there or like explained there to put any needed executable in the batch as some resource that would be extracted/decoded before being used.

Share this post


Link to post
Share on other sites
jaclaz    927

Never needed to use this means but if you go this way then you could also use something like the method used by Herbert Kleebauer there or like explained there to put any needed executable in the batch as some resource that would be extracted/decoded before being used.

Yes, of course :thumbup , though I personally tend to to use the simpler ECHOO.COM (also by Herbert Kleebauer):

for the little uses I need (which are usually connected to "dynamically produce some hex bytes).

I am really "old school" :ph34r: but I really see no issues in having an external tool and - whenever possible/advisable - I try not to "embed" anything inside "anything else", in which case the so-called "batch compilers" (which mostly - but not all ) do nothing but package the batch and the needed tools into a SFX archive, seem to me a better choice.

jaclaz

Share this post


Link to post
Share on other sites
tomasz86    68

For 2K (but also for XP if one wants to have the date/time format in the "full" UTC format), writing a file and immediately get it's created or last accessed time/date may be a good enough workaround :unsure:.

How about this as a workaround?

CD.>temp
cabarc n temp._ temp
FOR /F "skip=9 tokens=3-8 delims=/: " %%A IN ('cabarc l temp._') DO ECHO %%A%%B%%C.%%D%%E%%F

The result is same as using

date.exe +%%Y%%m%%d.%%H%%M%%S

Share this post


Link to post
Share on other sites
jaclaz    927

How about this as a workaround?

Which advantage has it when compared to the snippet in post #27 (that needs not cabarc or *any* external program)? :unsure:

The issue is that you need to create a file (in your case TWO of them).

jaclaz

Share this post


Link to post
Share on other sites
tomasz86    68

The advantage is that you also get seconds and that it's completely locale independent (you get hours in the 24-hour format).

Share this post


Link to post
Share on other sites
jaclaz    927

The advantage is that you also get seconds and that it's completely locale independent (you get hours in the 24-hour format).

Ah, well. :)

jaclaz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×