Search found 2267 matches

by dbenham
14 Jan 2020 08:00
Forum: DOS Batch Forum
Topic: Best way to obfuscate a Batch File?
Replies: 67
Views: 37339

Re: Best way to obfuscate a Batch File?

It could be done, but as I've said from the very beginning, I have no interest in writing code to de-obfuscate a script that has already been obfuscated.
by dbenham
12 Jan 2020 21:46
Forum: DOS Batch Forum
Topic: cmd.exe chars needing quotes, and escaping redirection handles
Replies: 6
Views: 298

Re: cmd.exe chars needing quotes, and escaping redirection handles

Interesting. I have the exact same configuration on my Win 10 desktop, and I get the same behavior. I re-read the cmd help, and I believe it is functioning as documented. ..................................................................... You can enable or disable completion for all invocations of...
by dbenham
11 Jan 2020 21:36
Forum: DOS Batch Forum
Topic: How to expand variable in another variable with string substitution?
Replies: 3
Views: 133

Re: How to expand variable in another variable with string substitution?

Your technique can work if you simply define displayvar properly. It works because SET /A can expand a variable on its own.\ @echo off setlocal SET var[1]=12 SET var[2]=23 set "displayvar=var[#]" set /a var=%displayvar:#=1% echo %var% --OUTPUT-- 12 But why on earth are you structuring things this wa...
by dbenham
09 Jan 2020 09:07
Forum: DOS Batch Forum
Topic: cmd.exe chars needing quotes, and escaping redirection handles
Replies: 6
Views: 298

Re: cmd.exe chars needing quotes, and escaping redirection handles

Hell, I already new I could do:

Code: Select all

echo Hello>"x&2".
So why didn't I realize all I needed was an absolute path?! :oops: :oops: :oops: :oops:

Code: Select all

echo Hello>"c:\test\&2"
The .\ hack naturally follows. :roll:
by dbenham
09 Jan 2020 06:51
Forum: DOS Batch Forum
Topic: cmd.exe chars needing quotes, and escaping redirection handles
Replies: 6
Views: 298

Re: cmd.exe chars needing quotes, and escaping redirection handles

1) Special characters listed in cmd help ... If completion is enabled with the /F:ON switch, the two control characters used are Ctrl-D for directory name completion and Ctrl-F for file name completion. :o Dind't know this, nor read this before. But CTRl-F doesn't work for me on win10, it opens a "...
by dbenham
08 Jan 2020 16:03
Forum: DOS Batch Forum
Topic: cmd.exe chars needing quotes, and escaping redirection handles
Replies: 6
Views: 298

cmd.exe chars needing quotes, and escaping redirection handles

Below are some newly discovered cmd.exe facts (at least for me) that likely no one cares about 1) Special characters listed in cmd help The following statement at the end of the cmd help (HELP CMD or CMD /?) used to really irk me. The special characters that require quotes are: <space> &()[]{}^=;!'+...
by dbenham
28 Dec 2019 21:41
Forum: DOS Batch Forum
Topic: Enhanced Batch
Replies: 3
Views: 649

Re: Enhanced Batch

Interesting project. I've had a brief moment to try this out - I see some very nice features 8)

I'm looking forward to the full release with documentation :!:
by dbenham
03 Dec 2019 09:27
Forum: DOS Batch Forum
Topic: jrepl new
Replies: 8
Views: 657

Re: jrepl new

Steffen's suggestion of adding |UTF-16 to the file names uses ADO, which is fine.

Another option is to use the /UTF option to take advantage of CSCRIPT's native ability to read UTF-16. It should be marginally faster.

Code: Select all

cmd /c jrepl.bat ",4," ",1," /utf /f "test1.txt" /o "testnew.txt"

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

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

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

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

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

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

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

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