Search found 917 matches

by jeb
02 Oct 2019 00:34
Forum: DOS Batch Forum
Topic: Enabling the internal debug outputs of cmd.exe
Replies: 17
Views: 6500

Re: Enabling the internal debug outputs of cmd.exe

No, it still works. At least with Microsoft Windows [Version 10.0.17134.1006] By using some nested FOR /F loops, I accidentally activated the debug mode. @echo off set "FOR_CMD=FOR /F "tokens=1-31" %%1 in ("jeb jeb") DO ^" %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CMD% %FOR_CM...
by jeb
01 Oct 2019 14:28
Forum: DOS Batch Forum
Topic: Some tricks with undefined variables
Replies: 3
Views: 545

Re: Some tricks with undefined variables

@jfl Nice ECHO! macro 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 1- Me too, nice...
by jeb
01 Oct 2019 13:33
Forum: DOS Batch Forum
Topic: Enabling the internal debug outputs of cmd.exe
Replies: 17
Views: 6500

Re: Enabling the internal debug outputs of cmd.exe

There is still hope :D
Last week, I accidentially activated the debug outputs on Win10, by nesting some FOR /F loops (some hundreds).

Tomorrow, I will try to search the batch files and reproduce it.
by jeb
13 Sep 2019 03:33
Forum: DOS Batch Forum
Topic: Some tricks with undefined variables
Replies: 3
Views: 545

Some tricks with undefined variables

Hi, 1) Default values undefined variables are more or less empty variables, but only inside batch files. The difference for batch files and command line echo var: %undefinedVar% Output when executed on the command line: var: %undefinedVar% Output when executed in a batch file var: But even in batch ...
by jeb
07 Sep 2019 02:44
Forum: DOS Batch Forum
Topic: CALL myBatch.bat can return to the wrong place
Replies: 4
Views: 576

Re: CALL myBatch.bat can return to the wrong place

I found one useful behaviour for the "missing stack entry". It works nearly the same as a GOTO, but there is one difference when it's in a command block or there are appended commands. A GOTO discards the other commands of a block and all appended commands (by &) @echo off echo [%0]: Before calling ...
by jeb
07 Sep 2019 02:15
Forum: DOS Batch Forum
Topic: CALL myBatch.bat can return to the wrong place
Replies: 4
Views: 576

Re: CALL myBatch.bat can return to the wrong place

Hi siberia-man, thanks for the interesting link, I was able to understand the posts, thanks to google translate. You described the ? and * for labels, there both characters works as expected, like any other charcter. But the key difference is using them not in a lable, instead use them in a called f...
by jeb
06 Sep 2019 11:52
Forum: DOS Batch Forum
Topic: CALL myBatch.bat can return to the wrong place
Replies: 4
Views: 576

CALL myBatch.bat can return to the wrong place

Hi, while refactoring my macro library, I found an unknown behaviour of the CALL/return file logic. :!: It fails when in the called batch file path at least one question mark or asterix is embedded. It seems a little bit related to the (goto) 2> nul glitch. First a sample, showing the normal behavio...
by jeb
06 Sep 2019 11:05
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 5288

Re: Closing parenthesis prevents escape of subsequent special character operator

Hi sst, I'm impressed by your analysis/debugging. :o :!: It explains so much. Now, I understand why the REM trick to gather the arguments works so good, and why it fails with multiline input. The REM parser will read the first token(GeToken) and compares it against "/?". If the token is "/?" it sets...
by jeb
29 Aug 2019 06:10
Forum: DOS Batch Forum
Topic: Replace "!" in a variable value when delayed expansion is on
Replies: 7
Views: 1498

Re: Replace "!" in a variable value when delayed expansion is on

Hi Penpen,

you are right. The Call is superfluous, I cpoied it from macro code.

@GCRaistlin
No it's not possible to use delayed expansion to replace a single bang, only when the bang is precede with other charactets.
by jeb
28 Aug 2019 11:24
Forum: DOS Batch Forum
Topic: Replace "!" in a variable value when delayed expansion is on
Replies: 7
Views: 1498

Re: Replace "!" in a variable value when delayed expansion is on

Hi GCRaistlin, yes, but it depends on the content of your string It's simple for simple content (without quotes in the content) @echo off setlocal DisableDelayedExpansion set "string=Test with caret ^ bang ! and some other <>&| %% stuff" setlocal EnableDelayedExpansion set "_tmp=%string:!=###%" set ...
by jeb
22 Aug 2019 13:36
Forum: DOS Batch Forum
Topic: How to use command output in echo? assign cmd output to var?
Replies: 2
Views: 1211

Re: How to use command output in echo? assign cmd output to var?

Hi pstein, it's not as easy like in bash with myVar=$(myCmd) But with the help of a macro you can simplify it to %$set% volumeName="vol D:" Or even multi line output of a command %$set% ipOutput="ipconfig" Here is the full sample, with the used macro (you don't need to undestand the macro itself) @e...
by jeb
22 Aug 2019 13:25
Forum: DOS Batch Forum
Topic: .Bat File calling with other .bat file with paramater isue
Replies: 2
Views: 1069

Re: .Bat File calling with other .bat file with paramater isue

Hi , your strlen batch is wrong, you doubled S="S= SET S="S=!%~2!#" The next problem is, that your parameters are wrong when calling the batch. CALL ...\islength.bat result1 !string1! The !string1! results into the expansion to the content, but the batch file expects only a variable name, not the co...
by jeb
21 Aug 2019 07:26
Forum: DOS Batch Forum
Topic: How <cr> behaves in a variable?
Replies: 2
Views: 1115

Re: How <cr> behaves in a variable?

Hi Szecska,

the cr character should be used only with delayded expansion.

So your code should be changed to

Code: Select all

 if "!key!" == "!cr!" Echo.
by jeb
02 Aug 2019 01:01
Forum: DOS Batch Forum
Topic: B A T C H R E C U R S I O N exceeds STACK limits
Replies: 3
Views: 2193

Re: B A T C H R E C U R S I O N exceeds STACK limits

Hi,

the error is not related to setlocal, but to the call stack.
Probably you have a recursion in your code, like

Code: Select all

:recursion
call :recursion
by jeb
13 Jul 2019 05:17
Forum: DOS Batch Forum
Topic: Passing arguments with spaces in it to a subroutine
Replies: 2
Views: 1962

Re: Passing arguments with spaces in it to a subroutine

Your problem is, that the spaces are outside of quotes, because of doble quoting call :info "!json!" -> call :info " {^ " a^": ^"a b c^"^, ^"b^": ^"x y z^"} " Only the red text is inside qotes, the rest is outside and the spaces are used as delimiters. You could solve that with carets in front of so...