Search found 2301 matches

by dbenham
29 Jan 2020 22:14
Forum: DOS Batch Forum
Topic: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect
Replies: 28
Views: 837

Re: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect

Processing redirection special characters in phase 2 is special in that I think it is the only case where the parser must look backward one or two characters - it has to determine if there is a file handle associated with the redirection. I'm thinking that may be an important factor why the CR only ...
by dbenham
29 Jan 2020 21:13
Forum: DOS Batch Forum
Topic: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect
Replies: 28
Views: 837

Re: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect

But now, how is this possible :?: Phase 1.5 removes the CR Phase 2 handles redirects, it shouldn't know that there was a CR at all Arggghhhhh :shock: :!: :!: :!: :!: :twisted: What proof do we have that removing <CR> characters is performed in an own phase and not handled as a special character in ...
by dbenham
29 Jan 2020 20:08
Forum: DOS Batch Forum
Topic: Erroneous GOTO does not break FOR loops
Replies: 2
Views: 257

Re: Erroneous GOTO does not break FOR loops

I did say, This may have been "obvious" to others . Yes, I know I have never seen evidence that a cached FOR loop is any different than any other cached code. (well, ignoring the fact that FOR /L is different :wink: ) I just don't recall ever seeing code that explicitly demonstrates (GOTO) treats FO...
by dbenham
29 Jan 2020 15:16
Forum: DOS Batch Forum
Topic: Erroneous GOTO does not break FOR loops
Replies: 2
Views: 257

Erroneous GOTO does not break FOR loops

This post is about the erroneous GOTO technique used to exit from a CALL but allow concatenated commands to execute in the context of the CALLer. It was first described in DosTips at Tricky way to detect calls from another batch script . It has been very useful. For example, it enabled creation of a...
by dbenham
14 Jan 2020 08:00
Forum: DOS Batch Forum
Topic: Best way to obfuscate a Batch File?
Replies: 67
Views: 38631

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

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

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

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

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

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: 4
Views: 1018

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

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

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

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

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.