Search found 2254 matches

by dbenham
15 Oct 2019 09:17
Forum: DOS Batch Forum
Topic: How can you compare two files Binary and notify?
Replies: 3
Views: 61

Re: How can you compare two files Binary and notify?

Similar to elzooilogico's answer, but more efficiently and without extraneous output:

Code: Select all

fc /b file1.bin file2.bin >nul && echo OK || echo ERROR
by dbenham
11 Oct 2019 05:28
Forum: DOS Batch Forum
Topic: How to work with CSV containing many columns
Replies: 3
Views: 307

Re: How to work CSV containing many columns

Your problems are related to working with large CSV files, having nothing to do with trimming a string to 300 characters. So I edited your title. You ought to consider doing your entire job with a scripting language better suited to the task - PowerShell, VBS, or JScript would all be better. But the...
by dbenham
10 Oct 2019 12:27
Forum: DOS Batch Forum
Topic: certutil -hashfile of a directory
Replies: 5
Views: 211

Re: certutil -hashfile of a directory

aGerman gave you code to put in a batch script. If you run from the command prompt then each %% must be modified to a single %. You might want to checkout HASHSUM.BAT - It is a batch script that only uses native commands. The command to generate the hash values for all the files would be: hashsum /p...
by dbenham
09 Oct 2019 15:36
Forum: DOS Batch Forum
Topic: Remove Microsoft header from cmd, for example when executing code from alternate data stream
Replies: 10
Views: 301

Re: Remove Microsoft header from cmd when executing code from alternative data stream

I believe one modification to Eureka's suggestion gives the correct result:

Remove PROMPT from each of your scripts, and then use:

Code: Select all

cmd /d /q /k prompt $h < %adsfile%:test1
Also use /K PROMPT $H whenever a script "calls" another script.

It worked for me
by dbenham
09 Oct 2019 13:55
Forum: DOS Batch Forum
Topic: Remove Microsoft header from cmd, for example when executing code from alternate data stream
Replies: 10
Views: 301

Re: Remove Microsoft header from cmd when executing code from alternative data stream

A few commands do not work properly when redirected to CON. The one I can remember is CLS - it outputs a funny character to the screen instead of clearing the screen when redirected to CON. You might consider redirecting to &2 (stderr) instead of CON. Screen output should then be the same as if stdo...
by dbenham
01 Oct 2019 10:08
Forum: DOS Batch Forum
Topic: Some tricks with undefined variables
Replies: 3
Views: 547

Re: Some tricks with undefined variables

@jfl Nice ECHO! macro :!: 8) I think 4) is useful when you want the definition of a macro to change depending on the state of some variable, for example if DEBUG is defined (enabled) or not. It allows incorporation of conditional text without creation of temp variables or staged definition @jeb I re...
by dbenham
25 Sep 2019 05:43
Forum: DOS Batch Forum
Topic: Search and insert multi-line pattern in text file?
Replies: 2
Views: 323

Re: Search and insert multi-line pattern in text file?

I just reread your question and realized that I misinterpreted your requirements in multiple ways. - you want multiple lines to represent a single search term (search across line breaks), not treat each line as a new term. - you want to append the the insert pattern after the found text, not replace...
by dbenham
24 Sep 2019 10:40
Forum: DOS Batch Forum
Topic: Search and insert multi-line pattern in text file?
Replies: 2
Views: 323

Re: Search and insert multi-line pattern in text file?

Simple with JREPL.BAT with the /T FILE option. jrepl "find.txt" "replace.txt" /l /t file /f "input.txt" /o "output.txt" where find.txt contains n number of search terms, one search term per line, and replace.txt contains the replacement strings, with the same n number of lines. The /L option specifi...
by dbenham
22 Sep 2019 08:07
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 443
Views: 210142

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

An alternative to using named character references is to use numeric character references in the form of &#nnnn; Then you don't need any special table of translations - you can use very simple JScript logic with the /JQ option. The following will translate any UTF-8 document into pure ASCII by trans...
by dbenham
21 Sep 2019 22:29
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 443
Views: 210142

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

That is pretty simple with the /T FILE option, and ADO. First modify your translations into two txt files representing your find and replace terms, one per line. find.txt (Must be encoded as Unicode - probably UTF-16LE or UTF-8) & < > © ® ´ « » ¡ ¿ À à Á á Â â Ã ã Ä ä Å å Æ æ Ç ç Ð ð È è É é Ê ê Ë ë...
by dbenham
18 Sep 2019 12:01
Forum: DOS Batch Forum
Topic: non-buffering FOR /F alternative
Replies: 7
Views: 580

Re: non-buffering FOR /F alternative

SET /P does not play nicely with pipes. However it does work as you want with files. So simply redirect your utility output to a temp file, and read the temp file with SET /P in an infinite loop. SET /P will return an empty string if there is no data waiting, so you need to ignore empty lines. This ...
by dbenham
18 Sep 2019 10:59
Forum: DOS Batch Forum
Topic: [Resolved] Alternative xcopy function to Choice - Carriage return as accepted character possible?
Replies: 3
Views: 383

Re: Alternative xcopy function to Choice - Carriage return as accepted character possible?

You might also want to look at :getKey and :getAnyKey that use REPLACE instead of XCOPY.

Both forms can return a value representing a carriage return, and have an option to specify valid characters, including Carriage Return.


Dave Benham
by dbenham
17 Sep 2019 16:50
Forum: DOS Batch Forum
Topic: Looking for a specific book
Replies: 16
Views: 1028

Re: Looking for a specific book

Amen to both misol101 and ShadowThief.

Especially misol101 - I needed a good laugh.
by dbenham
13 Sep 2019 11:20
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 443
Views: 210142

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

Well that was an easy fix. I replaced version 8.3 with version 8.4

I also updated the main release to version 8.4 at the original post in this thread.

Thanks again MarzSyndrome - you were a big help.


Dave Benham
by dbenham
13 Sep 2019 05:42
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 443
Views: 210142

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

That is most definitely a serious bug :!: :cry:

Not sure how long it will take, but I will definitely fix that.

Thanks for reporting - please don't hesitate to report any suspect behavior in the future.


Dave Benham