Search found 2127 matches

by dbenham
20 Oct 2018 21:36
Forum: DOS Batch Forum
Topic: JREPL.BAT v7.15 - regex text processor now with Unicode and XRegExp support
Replies: 393
Views: 132773

Re: JREPL.BAT v7.15 - regex text processor now with Unicode and XRegExp support

Here is version 7.15 JREPL7.15.zip Summary of Changes C:>jrepl /?history 2018-10-20 v7.15: Add a string literal syntax to the /INC and /EXC options. The new string literal syntax does not add any capability, but rather makes it easier to look for string literals because regular expression meta char...
by dbenham
19 Oct 2018 15:18
Forum: DOS Batch Forum
Topic: Multiple Echo statements within a Code Block crashing cmd.exe
Replies: 9
Views: 160

Re: Multiple Echo statements within a Code Block crashing cmd.exe

Here is a really simple script that uses CERTUTIL to encode any binary file as base64 and then embeds that into a batch file that will recreate the original file when run. The resultant batch file is only ~1.4 times the original binary size, and both the encode and decode operations are very fast. e...
by dbenham
17 Oct 2018 15:07
Forum: DOS Batch Forum
Topic: Multiple Echo statements within a Code Block crashing cmd.exe
Replies: 9
Views: 160

Re: Multiple Echo statements within a Code Block crashing cmd.exe

Perhaps the code block limit is not a constant. It could depend on available memory, .... ? I remember that the stack size limit for the total number of CALLs is also unpredictable.

How is the called :proc performance compared to the FOR performance?
by dbenham
17 Oct 2018 14:31
Forum: DOS Batch Forum
Topic: Multiple Echo statements within a Code Block crashing cmd.exe
Replies: 9
Views: 160

Re: Multiple Echo statements within a Code Block crashing cmd.exe

Have you tried the called :proc technique instead of the code block?
by dbenham
17 Oct 2018 12:37
Forum: DOS Batch Forum
Topic: Multiple Echo statements within a Code Block crashing cmd.exe
Replies: 9
Views: 160

Re: Multiple Echo statements within a Code Block crashing cmd.exe

I suspect it has nothing to do with ECHO or redirection, but rather has to do with a maximum code block size, whether it be lines or bytes. I don't know that such a limit exists. But remember that the entire code block must be parsed all at once and the result stored in memory, so it makes sense tha...
by dbenham
17 Oct 2018 05:29
Forum: DOS Batch Forum
Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
Replies: 49
Views: 22536

Re: JREN.BAT v2.8 - Rename files/folders using regular expressions

Here is version 2.8 @if (@X)==(@Y) @end /* Harmless hybrid line that begins a JScript comment @goto :Batch ::JREN.BAT version 2.8 by Dave Benham :: :: Release History: :: 2.8 2018-10-17: Updated links to Microsoft regex and replace docs :: Bug fix in ts() - tz:0 was not working :: 2.7 2016-12-15: A...
by dbenham
16 Oct 2018 13:59
Forum: DOS Batch Forum
Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
Replies: 49
Views: 22536

Re: JREN.BAT - Rename files/folders using regular expressions

Yeah, I fixed the help links in JREPL, but not JREN. I need to update JREN regex links to match JREPL. I should be able to get to this soon...

Dave Benham
by dbenham
16 Oct 2018 04:58
Forum: DOS Batch Forum
Topic: JREPL.BAT v7.15 - regex text processor now with Unicode and XRegExp support
Replies: 393
Views: 132773

Re: JREPL.BAT v7.14 - regex text processor now with Unicode and XRegExp support

Damn, we are sunk :( Your input contains null bytes (0x00), and JREPL requires the /M option whenever nulls are present. But your actual file is too large for /M :evil: C:\test>jrepl /?/m /M - Multi-line mode. The entire input is read and processed in one pass instead of line by line, thus enabling ...
by dbenham
15 Oct 2018 19:13
Forum: DOS Batch Forum
Topic: JREPL.BAT v7.15 - regex text processor now with Unicode and XRegExp support
Replies: 393
Views: 132773

Re: JREPL.BAT v7.14 - regex text processor now with Unicode and XRegExp support

Hmm, I had to add that again in the .cmd file. "find" and "repl" are envirnment variables so I have to use them with "%" on the beginn and on the end, right? I have to also put it under quotes because the string (^\d+ 0 obj\s*$|^/Name /Paragraph\s*$|^endobj\s*$|^.*$) contains empty spaces, right? N...
by dbenham
15 Oct 2018 13:35
Forum: DOS Batch Forum
Topic: Rename only first 2 characters
Replies: 1
Views: 87

Re: Rename only first 2 characters

To set the first two characters of all files in the current directory to XX:

Code: Select all

ren *.* XX*
See How does the Windows RENAME command interpret wildcards? over at StackExchange SuperUser for an explanation as to why this works.


Dave Benham
by dbenham
15 Oct 2018 13:21
Forum: DOS Batch Forum
Topic: JREPL.BAT v7.15 - regex text processor now with Unicode and XRegExp support
Replies: 393
Views: 132773

Re: JREPL.BAT v7.14 - regex text processor now with Unicode and XRegExp support

Here is version 7.14 JREPL7.14.zip This is simply a bug fix to allow user defined variables named str and/or obj, and to hide the internal xbytes variable from user code. 2018-10-15 v7.14: Bug fix - User defined variables declared in /JBEG named str and/or obj were getting clobbered. Bug fix - Inte...
by dbenham
15 Oct 2018 08:21
Forum: DOS Batch Forum
Topic: JREPL.BAT v7.15 - regex text processor now with Unicode and XRegExp support
Replies: 393
Views: 132773

Re: JREPL.BAT v7.13 - regex text processor now with Unicode and XRegExp support

I had to replace the variable assignment to the command to run it, but it does not create the expected output. call jrepl "%find%" "%repl%" /t "|" /jmatchq /jbeg init /v /u /f input.pdf /o output.pdf The output file (71MB) gets much larger than the input file (7MB) for some reason. No, the find and...
by dbenham
15 Oct 2018 05:58
Forum: DOS Batch Forum
Topic: JREPL.BAT v7.15 - regex text processor now with Unicode and XRegExp support
Replies: 393
Views: 132773

Re: JREPL.BAT v7.13 - regex text processor now with Unicode and XRegExp support

Upon looking closer at your original code, it looks like you are trying to remove all the objects that contain "/Name /Paragraph". @echo off setlocal set "init=var obj='', keep=true, eol='\n'" set "find1=^\d+ 0 obj\s*$" set "repl1=obj=$0+eol;$txt=false;" set "find2=^/Name /Paragraph\s*$" set "repl2=...
by dbenham
14 Oct 2018 17:36
Forum: DOS Batch Forum
Topic: JREPL.BAT v7.15 - regex text processor now with Unicode and XRegExp support
Replies: 393
Views: 132773

Re: JREPL.BAT v7.13 - regex text processor now with Unicode and XRegExp support

Unfortunately there is no way to circumvent the file size limit when using the /M option. I'm not sure the exact limit, but it is actually less than 1 GB. You may still be able to use JREPL if you ditch the /M option and combine the /T option with /JMATCH and custom JScript. You don't state what you...
by dbenham
09 Oct 2018 14:56
Forum: DOS Batch Forum
Topic: Text File Encoding ANSI to UTF-8
Replies: 3
Views: 179

Re: Text File Encoding ANSI to UTF-8

I agree, aGerman's ConvertCP.exe utility would be an ideal solution. You want to translate to code page 65001. Add the /B option if you want a BOM in your output. Alternatively, you could use my JREPL.BAT utility . It is designed to do regular expression find/replace operations on text files, but it...