Search found 259 matches

by pieh-ejdsch
24 Aug 2025 14:24
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

The EOL of the for loop is a semicolon (;).
If the first character is a semicolon, the loop will not be executed.
Therefore, the first token character must not be a semicolon.
Alternatively, the EOL must be set to empty.

Code: Select all

for /f tokens%%#=4%%#,8%%#,12%%#,16delims%%#=%%_%%# eol%%#= %%4 in ...
by pieh-ejdsch
22 Aug 2025 14:57
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

And I thought our general default test string for the batch is:

Code: Select all

/? !;:"(!^^ %%)@&%1^"*,><+
@Steffen I got wrong lengths in your code. Using bs in a delayed variable worked differently, but I had two characters too many. Did your code give you a correct result?
by pieh-ejdsch
18 Aug 2025 13:16
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

A version that uses octal numbers. It's really easy to work with because fewer for variables are needed—four instead of eight. This also made the code easier to write (don't think it was easy for me...). So the script is shorter too. The shift in the first for loop for using the four different varia...
by pieh-ejdsch
16 Aug 2025 14:42
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

An if else statement for measuring length was replaced with a for loop, resulting in a tiny improvement of 3...4 percent. Other versions are also available in the test code #65 . Since these are only bloated and do not achieve any performance gains, I did not use them. ::::::::::::::::::::::::::::::...
by pieh-ejdsch
13 Aug 2025 15:12
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

I saw that in Francesco's code. Then I tried it out. IF (a TRUE condition) & some more code that should also be fulfilled if TRUE & then something else that should be done if TRUE & (then the last little thing for TRUE) ELSE now the code that comes up if FALSE & something else that comes up if FALSE...
by pieh-ejdsch
13 Aug 2025 10:34
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

New macro [edit]I played around with the command chain a bit and sped up an if else (which no longer has an else). You should check it again with the old (rejected) code. It didn't run any faster—I had changed too much at once.[/edit] The penultimate else has now been moved up. This has eliminated a...
by pieh-ejdsch
12 Aug 2025 04:47
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

OK! Strange that the macro still works. Regardless of whether I have delayed ON or OFF during creation or execution. Well, that gave me the idea to include the colon in the first comparison instead of using the exclamation mark. Because the single exclamation mark is not [empty] in the CMD line (wit...
by pieh-ejdsch
10 Aug 2025 07:41
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

I have made the creation of the exclamation mark and caret a little shorter, which happens before the macro is created. FOR /F "tokens=1-3" %%! IN ("! ! ^ ^^^! . ^^^^") DO ^ It looks a little strange, but since the first caret disappears in delayed expansion, it can already be used as the third token.
by pieh-ejdsch
07 Aug 2025 12:26
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

@Francesco Here is a brief summary of the steps again. The things I changed were: Converting the use of For variables into hard-coded delayed normal variables as early as possible. Since For variables can be used well as name storage, but expanding the For variable within exclamation marks takes tim...
by pieh-ejdsch
07 Aug 2025 09:00
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

Well, Francesco, I tinkered with the macros until they got faster and achieved this performance The quotation marks can be omitted everywhere if the variable expansion does not contain a comma. The closing brackets are attached directly to the variables to be set, as is the follow-up command. set /a...
by pieh-ejdsch
04 Aug 2025 15:39
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

The first token in the For-loop can actually be a single exclamation mark, just like in if. The parser first evaluates the loop or the if and the exclamation mark is only resolved at execution time. Two exclamation marks are also larger than the ' . Twice (empty) is also smaller than ' . The exclama...
by pieh-ejdsch
04 Aug 2025 08:25
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

I couldn't resist writing an even shorter and faster version than yesterday's after trying out lots of different things. I noticed the following: A for variable with a tilde ~ slows down execution because any quotation marks have to be removed first—regardless of whether there are any or not. Using ...
by pieh-ejdsch
03 Aug 2025 12:56
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 91
Views: 213081

Re: strLen boosted

Hi at all, I've created a few versions so you can see why it runs faster or slower. In any case, the final2 version isn't the fastest. Ultimately, every unnecessary "if else" and every too many "set statements" and "variable calls" slows down the script. But you can find a balance between these many...
by pieh-ejdsch
15 Jun 2025 09:33
Forum: DOS Batch Forum
Topic: Stack Overflow article.
Replies: 7
Views: 17040

Re: Stack Overflow article.

The main problem that AI brings with it: It only ever presents solutions to past problems. That's why I see AI as a data collector that can't analyze problems itself, but will only present solved problems over and over again for problems that have already been solved. Throw the syntax of the command...
by pieh-ejdsch
18 Mar 2025 15:23
Forum: DOS Batch Forum
Topic: Copy PDFs from publish subfolder to two other locations
Replies: 1
Views: 5479

Re: Copy PDFs from publish subfolder to two other locations

hallo Calm, Are the file names formed according to any naming conventions that can be used for distribution? Which files should be copied? All those that are NOT saved in C:\BOX? Or should the data to be saved be selected again separately? c/box/project/123 - job name /01 drawings/pdfs/1000 - ELEV c...