Search found 2429 matches

by dbenham
21 Aug 2020 20:35
Forum: DOS Batch Forum
Topic: Arrow keys
Replies: 5
Views: 4862

Re: Arrow keys

At the bottom of that page it shows how to use batch + DEBUG to patch the old version of CHOICE to get the non-standard behavior that can read special keys. Not very useful, considering most installations of Windows do not support the DEBUG command. Also, there are multiple versions of CHOICE out th...
by dbenham
21 Aug 2020 05:53
Forum: DOS Batch Forum
Topic: Arrow keys
Replies: 5
Views: 4862

Re: Arrow keys

I have never seen any version of choice that supports an /S option, certainly not in any standard Windows CHOICE command.

Not surprisingly, this does not work on my Windows 10 machine.

You must have a non-standard CHOICE.EXE file.


Dave Benham
by dbenham
01 Aug 2020 14:11
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
Replies: 61
Views: 94378

Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like

There is nothing complicated about it - the original post in this thread shows the basic technique. Just a few minor tweaks to get your behavior: echo %correctMD5% *C:\program\config.ini | hashsum /c /q && goto :step1 || goto :step2 Just be sure to put an asterisk before your file path, and don't us...
by dbenham
30 Jul 2020 17:20
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 550
Views: 2008320

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

:lol: Good idea, but its not gonna be written by me. I do wonder what I would have received if JREPL was shareware with a suggestion of $5 per user. I did receive an unsolicited donation from one user - that was pretty cool, and a total surprise. If I ever write the compiled .NET version (major rewr...
by dbenham
30 Jul 2020 16:22
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 550
Views: 2008320

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

Here is JREPL version 8.6 JREPL8.6.zip Summary of changes: 2020-07-30 v8.6: Added options to /K, /R, and /MATCH to count the number of matches or rejects instead of printing them. Added the counter /JScript variable. Fixed /T Pig Latin example - $0 corrected to read $& FIND /C "search" counts the n...
by dbenham
29 Jul 2020 17:05
Forum: DOS Batch Forum
Topic: Memory leak when reading large text files
Replies: 19
Views: 14484

Re: Memory leak when reading large text files

Here is a very fast solution that shouldn't have any memory issues. I use FINDSTR to do all the heavy lifting. The first FINDSTR only preserves lines that contain ":\" and lines that equal "end line". The odd syntax is due to FINDSTR peculiarities when dealing with \ and " characters. That result is...
by dbenham
17 Jul 2020 15:14
Forum: DOS Batch Forum
Topic: loop without for to read lines of a file
Replies: 15
Views: 12149

Re: loop without for to read lines of a file

Handle 3 definitely starts off as undefined. Explanation of your middle test: Starting condition (call it START) 1 = stdout 2 = stderr 3 = undefined 4 = undefined 5 = undefined Redirection of left side block: 1>&3, current definition of 1 is stored in first available (3), and then 1 is set to curren...
by dbenham
17 Jun 2020 06:00
Forum: DOS Batch Forum
Topic: JREPL to check 12 columns for a certain string?
Replies: 2
Views: 3373

Re: JREPL to check 12 columns for a certain string?

Quite simple actually. You just need to write a regex that matches lines to be deleted and use the /R option to reject lines that match and the /XSEQ option to enable substitution of \c for ^ and \q for " The \c is needed due to the pesky doubling of ^ when using CALL call jrepl "\c(?:[\c,]*,){4}(?:...
by dbenham
06 Jun 2020 11:33
Forum: DOS Batch Forum
Topic: Redirect output to file without using > sign?
Replies: 12
Views: 9562

Re: Redirect output to file without using > sign?

@echo off call :writeFile >output.txt exit /b :writeFile - All output from this routine will be written to output.txt echo Line 1 echo Line 2 echo etc. exit /b Or, if you already have existingScript.bat that writes your desired output to the console (stdout), then from the console command line: c:\...
by dbenham
01 Jun 2020 20:37
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 550
Views: 2008320

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

You should have no problem removing \r (carriage return) in the middle of a line without the /M option. You can remove all \r that are not part of the standard \r\n end of line with the following: call jrepl "\r" "" /f "file.txt" /o - As each line is read, the \r\n end of line is automatically strip...
by dbenham
29 May 2020 06:38
Forum: DOS Batch Forum
Topic: Batch rename
Replies: 3
Views: 3756

Re: Batch rename

I originally forgot to left zero pad the number to 4 digits. I edited my prior post to add the padding
by dbenham
29 May 2020 05:50
Forum: DOS Batch Forum
Topic: Batch rename
Replies: 3
Views: 3756

Re: Batch rename

This is trivial with JREN.BAT - a hybrid JScript/batch regular expression renaming utility call jren "^.*" "lpad($n,'0000')+'.jpg'" /j /p "c:\pathToYourFolder" /rfm "^[a-z0-9]+$" It is not much more complicated to use pure batch @echo off setlocal enableDelayedExpansion pushd "c:\pathToYourFolder" f...
by dbenham
27 May 2020 14:22
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 550
Views: 2008320

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

Pipe is a regex meta-character that means alternation (basically an OR operator). Like any meta character, you escape it with a backslash. The /XSEQ and /M options aren't needed. So JREPL "\|" "" /f TEST2.txt /o TEST2b.txt The other option is to use the /L literal option, so the search is treated as...
by dbenham
25 May 2020 10:28
Forum: DOS Batch Forum
Topic: [SOLVED] Extract data to .txt file and then sort new file.
Replies: 10
Views: 8549

Re: Extract data to .txt file and then sort new file.

Your original request to preserve the first 3 title lines, and then extract and sort the remaining lines that contain FALSE, can be easily solved with JSORT.BAT , plus a little sideways thinking with your use of FINDSTR. JSORT is a hybrid JScript/batch with a number of useful options: Skip n lines (...
by dbenham
25 May 2020 08:31
Forum: DOS Batch Forum
Topic: Just the total size of a folder & subfolders
Replies: 3
Views: 4106

Re: Just the total size of a folder & subfolders

JREN.BAT is a hybrid batch/JScript regular expression file/folder renaming utility. But it also has options that make it useful as a directory listing utility, with the ability to display the total size of all files within a folder (including all subfolders recursively). The following will give the...