Search found 2357 matches

by dbenham
09 Sep 2020 04:09
Forum: DOS Batch Forum
Topic: LABEL Being Processed without GOTO or CALL
Replies: 11
Views: 2062

Re: LABEL Being Processed without GOTO or CALL

Good idea. I would never use it, but I see how it can be helpful to some.
by dbenham
07 Sep 2020 10:37
Forum: DOS Batch Forum
Topic: LABEL Being Processed without GOTO or CALL
Replies: 11
Views: 2062

Re: LABEL Being Processed without GOTO or CALL

There is a problem with this code snippet: IF ERRORLEVEL 1 EXIT /b %ErrorLevel% ________ That will generate a visible error if ERRORLEVEL is <= 0. Better to use ======================= as that character parses as white space, so no error. The equal sign is easier to type as well. Alternatively prefi...
by dbenham
30 Aug 2020 12:56
Forum: DOS Batch Forum
Topic: g.bat to jump between folders - need help to make it pure batch!
Replies: 16
Views: 3149

Re: g.bat to jump between folders - need help to make it pure batch!

I developed CDX.BAT to address the same issues long ago, based on an idea found at the ss64.org cmd forum . Rather than build an index of the entire volume(s), it allows each user to develop their own custom list of commonly accessed folders. Full help is available via CDX /? I haven't had a chance ...
by dbenham
21 Aug 2020 20:35
Forum: DOS Batch Forum
Topic: Arrow keys
Replies: 5
Views: 626

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: 626

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.6 - emulate md5sum, shasum, and the like
Replies: 47
Views: 31593

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: 469
Views: 374923

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: 469
Views: 374923

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: 1460

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: 1932

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: 984

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: 2088

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: 469
Views: 374923

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: 1097

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: 1097

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...