Search found 2259 matches

by dbenham
08 Nov 2019 18:18
Forum: DOS Batch Forum
Topic: Isometric Bullet Dodging Game
Replies: 7
Views: 212

Re: Isometric Bullet Dodging Game

An alternative to adding the Q key that can freeze the game is to use the presence of a file as a signal that the player has died. I used that technique for multiple purposes in SNAKE.BAT. and, Doh! you forgot to add a Quit option to the Menu :!: Here is the modified code @ECHO OFF SETLOCAL ENABLEDE...
by dbenham
07 Nov 2019 07:35
Forum: DOS Batch Forum
Topic: Isometric Bullet Dodging Game
Replies: 7
Views: 212

Re: Isometric Bullet Dodging Game

But your mention of 0 vs 1 reminded me that I forgot to subtract one from the score upon returning from the pipe when you die. I fixed the code a few posts back.
by dbenham
06 Nov 2019 22:39
Forum: DOS Batch Forum
Topic: Isometric Bullet Dodging Game
Replies: 7
Views: 212

Re: Isometric Bullet Dodging Game

So I could differentiate between quit while alive and death. That allows me to ECHO out "You died" when appropriate. The window title is reset once the child processes are terminated.
by dbenham
06 Nov 2019 13:24
Forum: DOS Batch Forum
Topic: Isometric Bullet Dodging Game
Replies: 7
Views: 212

Re: Isometric Bullet Dodging Game

Nicely done. I assume you've seen SNAKE.BAT . It didn't take much to enhance your code to allow cleanly exiting the game. My added/modified code is in lower case. Press Q to exit the game. This could be before or after you die. Either way, your final score is printed. @ECHO OFF SETLOCAL ENABLEDELAYE...
by dbenham
28 Oct 2019 09:02
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.4 - regex text processor with support for text highlighting and alternate character sets
Replies: 445
Views: 224539

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

The /INC option does not help because it is line based - all text within the included lines is searched. But you want to search only the text on the line(s) that is between the braces. You need the /P and /PREPL options to specify the regions of the file to search. You need /M because the braced tex...
by dbenham
15 Oct 2019 09:17
Forum: DOS Batch Forum
Topic: How can you compare two files Binary and notify?
Replies: 3
Views: 1318

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

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

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

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

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

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

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

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: 445
Views: 224539

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: 445
Views: 224539

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) & < > © ® ´ « » ¡ ¿ À à Á á Â â Ã ã Ä ä Å å Æ æ Ç ç Ð ð È è É é Ê ê Ë ë...