Search found 4570 matches

by aGerman
18 Jul 2025 13:38
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

What do you think of that one? :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :initStrLen :: Computes the number of bytes in a string. :: %strLen% str len :: str - [ByRef In] Name of the variable containing the string to be measured. :: len - [ByRef Out] Name of the...
by aGerman
17 Jul 2025 11:02
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

Your latest wrapped into a macro: :initStrLen :: Computes the number of bytes in a string. :: %strLen% str len :: str - [ByRef In] Name of the variable containing the string to be measured. :: len - [ByRef Out] Name of the variable that receives the measured length. :: Strings of up to 8190 characte...
by aGerman
17 Jul 2025 09:48
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

Re: "Why does SET performance degrade as environment size grows?" Nothing changed in the way environment variables are handled in the process. So I guess the impact of the size/amount of variables decreased only because we have faster processors, multi-core processors, better branch prediction, more...
by aGerman
16 Jul 2025 16:15
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

Looks really promising. I'll try to wrap it into a macro tomorrow. Just attempting to answer your question but they told me the set problem related to the env size is no longer there It depends. The limit in the CMD is still 8191. I just tried to add another x to the str1 variable as in my test code...
by aGerman
15 Jul 2025 13:15
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

The $strlen macro that you have in your test code now is pretty much the same as the latest strLen macro I posted :lol: It's just that yours always expects that delayed expansion is enabled and that $len is the predefined name for the output. Besides of that, yours also handles the 255 characters fo...
by aGerman
12 Jul 2025 05:57
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

Addendum: Of course we could call setlocal/endlocal conditionally, depending on whether delayed expansion is already enabled. I changed variable names slightly to mitigate the risk of name clashes. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :initStrLen :: Comput...
by aGerman
09 Jul 2025 13:40
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

I don't feel like continuing to try to squeeze out every last hundredth of a second 🤯 That's it for now: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :initStrLen :: Computes the number of bytes in a string. :: %strLen% str len :: str - [ByRef In] Name of the varia...
by aGerman
06 Jul 2025 14:54
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

It's really unreadable, and the variable names are, at best, ugly. Agreed. At least I tried to have it consistently ugly :lol: However, it's tricky to get reliable time measurements on a modern system, where the CPU frequency fluctuates constantly. Yeah. To mitigate it I run the tests in realtime p...
by aGerman
06 Jul 2025 07:36
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

Some more fiddling 😅 Francesco's approach was not too far away. So I made it a macro and fit for 8191-character strings. It turns out that it works well for very long strings. So I took the part for strings >255 characters and mixed it with the dipstick for <= 255-character strings. Surprisingly the...
by aGerman
04 Jul 2025 12:10
Forum: DOS Batch Forum
Topic: Deleting hidden and read-only files with pure Batch [SOLVED]
Replies: 2
Views: 226

Re: Deleting hidden and read-only files with pure Batch

You mean someting like this?

Code: Select all

del /f /a "D:\somewhere\whatever file.ext"
Steffen
by aGerman
03 Jul 2025 10:59
Forum: DOS Batch Forum
Topic: strLen boosted
Replies: 43
Views: 137025

Re: strLen boosted

It's been too hot to do anything outdoors yesterday. So I came back to this old topic because I remembered Antonio came up with something new last year. I made a few performance comparisons. I turns out that this technique is unfortunately slower than the latest that sowgtsoi posted. Francesco's ada...
by aGerman
03 Jul 2025 09:56
Forum: DOS Batch Forum
Topic: VBS returns localized TRUE/FALSE
Replies: 3
Views: 172

Re: VBS returns localized TRUE/FALSE

You can cast the boolean values in VBS already (using the cint function). This way FALSE becomes 0 and TRUE becomes -1. This said, you should really make the vbs scan the whole file at once. Calling cscript for every line will be horribly slow. Or use JREPL.bat or any other tool with better regex su...
by aGerman
01 Jul 2025 12:46
Forum: DOS Batch Forum
Topic: Get set /p to accept file suffix.
Replies: 11
Views: 1086

Re: Get set /p to accept file suffix.

The strategy is simple. 1) If a dot is found in %Suffix%, remove everything that comes before including the dot itself. So "*.xls", ".xls" and "xls" all become "xls" in the first SET statement. (For more information run SET /? and read about environment variable substitution.) 2) Because Get-ChildIt...
by aGerman
30 Jun 2025 15:05
Forum: DOS Batch Forum
Topic: Get set /p to accept file suffix.
Replies: 11
Views: 1086

Re: Get set /p to accept file suffix.

Screenshot 2025-06-30 224917.png Screenshot 2025-06-30 225044.png As you can see, SET /P just assignes whatever the user enters. It cannot do anything else. I f you insert these two lines after your SET /P set "Suffix=%Suffix:*.=%" set "Suffix=*.%Suffix%" it doesn't matter if the user omits the ast...
by aGerman
30 Jun 2025 12:01
Forum: DOS Batch Forum
Topic: Get set /p to accept file suffix.
Replies: 11
Views: 1086

Re: Get set /p to accept file suffix.

I doubt that this is a cmd issue. It's just the way how the -Filter parameter of the PowerShell Get-ChildItem cmdlet works. It needs the asterisk as a wildcard for the file name. So, what are you trying to do? Manually prepend the asterisk whenever the user didn't enter it?

Steffen