I realize there are alot of solutions out there in google for finding the length of a string using a batch file. I have tried to understand 3 different ones listed, and was unsuccessful. I have placed a copy of one of the scripts I found through google below. Could someone explain/help me understand it? Or give me a new solution that they can explain better?
here is one solution: (and listed just below is what I don't understand)
set test_=Testing the length of a string
for %%i in (1 2 3 4 5 6 7 8) do echo 1234567890>>tmp$$$.txt
dir tmp$$$|find "TMP$$$ TXT">tmp$$$2.bat
echo set lenght_=%%2>tmp$$$.bat
echo set length_=%%%lenght_%>tmp$$$.bat
for %%f in (tmp$$$*.*) do if exist %%f del %%f
What I don't understand:
1. Why "$$$" is used, and what does it mean?
2. Why "%%%" is used, and what does it mean?
3. The line starting with "echo set length" (IE: what is this: "%%%lenght_%" ?).
4. The last line. (it seems like it's not finished.)
Thank you for any help!
There are currently 1 users browsing this thread. (0 members and 1 guests)