Search found 2316 matches

by dbenham
20 Mar 2020 08:57
Forum: DOS Batch Forum
Topic: 8191 buffer limit: Different Windows 10 builds behave differently
Replies: 5
Views: 169

Re: 8191 buffer limit: Different Windows 10 builds behave differently

I'm curious what the behavior is with XP (or any other version). Windows XP pro, 32 bit, Version 5.1.2600, just terminates the execution of the batch ater the first performed test (same behaviour for all tests): ----------------------------------------------- :test1 Die eingegebene Zeile ist zu lan...
by dbenham
20 Mar 2020 06:07
Forum: DOS Batch Forum
Topic: 8191 buffer limit: Different Windows 10 builds behave differently
Replies: 5
Views: 169

Re: 8191 buffer limit: Different Windows 10 builds behave differently

At the beginning of the test the behavior is different than later, and the original behavior can't be reset by closing cmd.exe. I can reset it only by restarting the computer. The changes are relevant for the size of lines and if they throw an error or not. In the beginning my lines can be very lon...
by dbenham
19 Mar 2020 21:26
Forum: DOS Batch Forum
Topic: 8191 buffer limit: Different Windows 10 builds behave differently
Replies: 5
Views: 169

8191 buffer limit: Different Windows 10 builds behave differently

The 8191 character size limit is pervasive throughout cmd.exe batch parsing. There are many buffers in the various phases, each one limited to 8191 bytes. I wanted to investigate how each "phase" handles an overflow of the buffer. I know sometimes it creates an error, sometimes the data is truncated...
by dbenham
13 Mar 2020 19:08
Forum: DOS Batch Forum
Topic: Get line with highest numerical string
Replies: 6
Views: 339

Re: Get line with highest numerical string

It wouldn't be hard to write a custom JScript or VBScript solution. I went ahead and developed a JREPL.BAT solution - it is significantly faster than any pure batch solution once the input becomes "large". I used line continuation just to make it easier to read. jrepl "^outbox/logs/.*?(\d+)\.log$"^ ...
by dbenham
13 Mar 2020 15:08
Forum: DOS Batch Forum
Topic: Arithmetic inside Round brackets leads to Missing operand
Replies: 10
Views: 352

Re: Arithmetic inside Round brackets leads to Missing operand

Your way of dealing with dates is not good as it depends on the locale settings for the computer. For example, %date% on my machine yields Fri 03/13/2020 which completely breaks your code. You should be using FOR /F with WMIC OS GET LOCALDATETIME to get the date and/or time in a way that can be par...
by dbenham
13 Mar 2020 13:09
Forum: DOS Batch Forum
Topic: Arithmetic inside Round brackets leads to Missing operand
Replies: 10
Views: 352

Re: Arithmetic inside Round brackets leads to Missing operand

FYI - No need to create a separate topic when this last question is obviously related to the previous. The ; at the end of the statement is causing the problem. SET /A sort of is expecting a second computation, although the proper symbol to use for multiple computations is a comma. Remove the semico...
by dbenham
13 Mar 2020 09:52
Forum: DOS Batch Forum
Topic: Arithmetic inside Round brackets leads to Missing operand
Replies: 10
Views: 352

Re: Arithmetic inside Round brackets leads to Missing operand

SET /A is the one case where you don't need delayed expansion because SET /A can expand variables directly - there is no need to use % or ! expansion. set /a "result=result*2" :: or better yet set /a "result*=2" But why do you initially set result to 8 in the first place? why not set /a "result=8*2"...
by dbenham
13 Mar 2020 08:08
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.5 - regex text processor with support for text highlighting and alternate character sets
Replies: 448
Views: 294237

Re: JREPL.BAT v8.5 - regex text processor with support for text highlighting and alternate character sets

The above post is a follow-up question to my StackOverflow answer to this question . Based on the OP's last comment on 2020-03-11 , the solution is to escape the quotes and backslashes as \" and \\ when using Webpack ShellPlugin: call "./framework/config/JREPL.BAT" \"(Error)\\(([\\c()]*|\\(([\\c()]*...
by dbenham
10 Mar 2020 15:50
Forum: DOS Batch Forum
Topic: Copy one file to seperate folder
Replies: 1
Views: 339

Re: Copy one file to seperate folder

Please note that windows uses \ in paths, not / Also, you should learn to use the markup language supported by this site - html does not work. The buttons at the top of the post editor work well, and are pretty self-evident. The following one liner should do the trick from the command line for /r "c...
by dbenham
10 Mar 2020 09:58
Forum: DOS Batch Forum
Topic: choice command problem
Replies: 1
Views: 362

Re: choice command problem

You must have named your batch script choice.bat or choice.cmd, so your script is calling itself instead of executing the CHOICE command. Rename your script to something else.

You should never name a script the same as an existing command.


Dave Benham
by dbenham
06 Mar 2020 11:07
Forum: DOS Batch Forum
Topic: [SOLVED] [regex] Multiline seeking with (s)sed?
Replies: 8
Views: 1199

Re: [SOLVED] [regex] Multiline seeking with (s)sed?

A JREPL solution without the /M option (no size limit as long as no line approaches 1 GB) can be done in 3 steps (assuming all <desc> and </desc> are paired properly): :: Remove all <desc>...</desc> blocks within one line call jrepl "<desc>.*?</desc>" "" /f "input.xml|utf-8" /o - :: Remove all lines...
by dbenham
06 Mar 2020 09:07
Forum: DOS Batch Forum
Topic: [SOLVED] [regex] Multiline seeking with (s)sed?
Replies: 8
Views: 1199

Re: [regex] Multiline seeking with (s)sed?

Note - XML CDATA and/or comments containing <desc> or </desc> are likely to break any regular expression based solution. Regular expressions should generally not be used to parse or manipulate XML unless you are confident in the physical layout of the XML file.
by dbenham
06 Mar 2020 08:29
Forum: DOS Batch Forum
Topic: [SOLVED] [regex] Multiline seeking with (s)sed?
Replies: 8
Views: 1199

Re: [regex] Multiline seeking with (s)sed?

As a work-around, I'll just install Perl and run a one-liner. Another option is to use my JREPL.BAT regular expression file processing utility . It is pure script (hybrid JScript/batch) that runs natively on any any Windows version from XP onward, without the need of any 3rd party exe or dll file. ...
by dbenham
29 Feb 2020 21:35
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.5 - regex text processor with support for text highlighting and alternate character sets
Replies: 448
Views: 294237

Re: JREPL.BAT v8.5 - regex text processor with support for text highlighting and alternate character sets

Here is JREPL version 8.5 JREPL8.5.zip Summary of Changes 2020-02-29 v8.5: Added /EOL option to set the end of line terminator. Added the eol global jscript variable. Doc fix - No EOL if /RTN option specifies a :LineNumber. . . . New /EOL option /EOL EndOfLineString Write lines using EndOfLineStrin...
by dbenham
26 Feb 2020 10:08
Forum: DOS Batch Forum
Topic: [SOLVED] Using GNU grep in a Windows batch script?
Replies: 9
Views: 1966

Re: Using GNU grep in a Windows batch script?

Your problem is grep and cmd.exe have different quoting and escape rules. You need to account for both, remembering that cmd.exe quoting/escaping is processed before grep. cmd.exe does not have a mechanism to escape a double quote within a double quoted string. Once quoting has begun, the next quote...