Search found 470 matches

by Liviu
25 Jan 2012 20:16
Forum: DOS Batch Forum
Topic: An example of extreme dynamic variable nesting.
Replies: 8
Views: 10467

Re: An example of extreme dynamic variable nesting.

Not on my version of XP ... I also ran your code from this thread and it also crash http://www.dostips.com/forum/viewtopic.php?f=3&t=2851 Build 2600 xp sp2 Interesting... For the latter, do you mean a literal "crash", and was it with the "call :exec" (vs. "call :exec-fa...
by Liviu
25 Jan 2012 19:52
Forum: DOS Batch Forum
Topic: An example of extreme dynamic variable nesting.
Replies: 8
Views: 10467

Re: An example of extreme dynamic variable nesting.

' I still like jeb's way, it produce same result @echo off &setlocal enableDelayedExpansion set "var=hallo > aa ^| bb ^^< cc ^^^& dd" echo.!"!!var!!"! Thanks for the pointer, though, unless I am missing something, so does "echo !var!" alone in this snippet. And...
by Liviu
25 Jan 2012 19:03
Forum: DOS Batch Forum
Topic: unexpected jump
Replies: 8
Views: 7789

unexpected jump

This may well be an xp.sp3 quirk, haven't tried it elsewhere, yet. But it's quite odd. Here's the code... @echo off setlocal disableDelayedExpansion echo. echo * %~n0 { %1 } set /a rearg1 = %1 - 1 if %rearg1% leq 0 goto :done echo * before call :exec %0 %rearg1% call :exec-fail %%0 rearg1 echo ..aft...
by Liviu
25 Jan 2012 18:37
Forum: DOS Batch Forum
Topic: An example of extreme dynamic variable nesting.
Replies: 8
Views: 10467

Re: An example of extreme dynamic variable nesting.

But it is not possible to build a string with special characters and make a call, the expansion have to be on the last call level. ... Because all carets are doubled by a call, so the parser see ... If the char "&" or "|" is recognized in a call the complete cmd will be canc...
by Liviu
24 Jan 2012 23:14
Forum: DOS Batch Forum
Topic: help - prompt for password
Replies: 4
Views: 6836

Re: help - prompt for password

If the exe reads the password off its "standard input stream" you may try "echo yourpassword| yourexe". However, if it's reading it directly off the interactive console, or if it's a GUI app with no console whatsoever, that won't work. And, just saying, but I wouldn't hardcode a ...
by Liviu
24 Jan 2012 13:28
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 105262

Re: foolproof counting of arguments

Yet another variation on the same theme... The code below collects all parameters in a temp file, with the stop condition based on the size of the file. Then, it reads the file back in one shot. EDIT: code below has changed vs. the one posted earlier today. At the time I edited, there were no follow...
by Liviu
24 Jan 2012 00:42
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 105262

Re: foolproof counting of arguments

Now I understand why jeb had that # in his REM statement, to protect against /? I've edited my previous post to compensate. Pretty sure I've seen this noted before, though I can't find a reference handy now... One other corner case is that the 'for' loop would save the incorrect %1 when passed %a o...
by Liviu
23 Jan 2012 10:50
Forum: DOS Batch Forum
Topic: a little unicode related subtopic
Replies: 22
Views: 21555

Re: a little unicode related subtopic

The font makes no difference, except look different on the screen and in screen snapshots (or, worse, look the same for different binary characters depending on the active codepage). Whenever in doubt, check the actual file contents with your favorite binary viewer. I suppose it looks a bit like it...
by Liviu
23 Jan 2012 10:35
Forum: DOS Batch Forum
Topic: a little unicode related subtopic
Replies: 22
Views: 21555

Re: a little unicode related subtopic

' I think my code works for everyone ( just guessing ) if I simply use ... If not please let me know, thanks for the quick responses I'd guess it works provided it's you who save/publish/send the batch file. However, if people copy the code from your post and save the batch file themselves, they'd ...
by Liviu
23 Jan 2012 01:33
Forum: DOS Batch Forum
Topic: a little unicode related subtopic
Replies: 22
Views: 21555

Re: a little unicode related subtopic

It might not make any difference, but which font are you using, and do you also get the display that picture shows when you paste it in the command prompt? The font makes no difference, except look different on the screen and in screen snapshots (or, worse, look the same for different binary charac...
by Liviu
23 Jan 2012 01:23
Forum: DOS Batch Forum
Topic: a little unicode related subtopic
Replies: 22
Views: 21555

Re: a little unicode related subtopic

' Taripo reported codepage problems in this topic [...] My PIPE.COM program is only 69 bytes in size, so it is a very good replacement of FINDSTR to be used in these cases. If you are worried about where to get my program from, here it is; just copy the 69 bytes below to a file named PIPE.COM and i...
by Liviu
22 Jan 2012 22:18
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 105262

Re: foolproof counting of arguments

Here is a clean looking script that safely loads all of the arguments into an arg "array" using the REM trick. Not sure I fully follow the part about exiting and reentrying the doubly redirected () block, yet, but it looks as if it's internally equivalent to individual per-argument redire...
by Liviu
22 Jan 2012 20:36
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 105262

Re: foolproof counting of arguments

It's still not exactly foolproof Example argument (jeb): one^&two"&three simplified: "& or "&" Thanks for that. Somehow thought it couldn't be that easy And it takes down any following parameters as well. Now, I don't think that'd be much of a problem in my parti...
by Liviu
22 Jan 2012 16:50
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 105262

Re: foolproof counting of arguments

I'm not sure whether this would work in each case: Nice! and appears to be doing just what I was looking for, thank you. Side comment: it's even kind of obvious in hindsight now, isn't it Guess I didn't think at it becaused of the reflex don't set "x=%1" when %1 may contain quotes or unqu...
by Liviu
22 Jan 2012 15:36
Forum: DOS Batch Forum
Topic: foolproof counting of arguments
Replies: 56
Views: 105262

Re: foolproof counting of arguments

Don't think there is much you could do about a string not being closed quoted correctly. If you just have a set of empty quotes then you can check to see if it is empty. So given your example of "" a --- I should have made it more clear that the "---" was part of my comment, not...