Search found 175 matches

by doscode
27 Jun 2012 01:36
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

@Antonio, question: for ... () do ( if !cnt! EQU 0 SET BREAK= REM inner loop: for ... () do ( <-- some code here --> if !ThisIsLegalNumber! EQU 1 ( SET legalNumber=!second! SET /A cnt=!cnt!+1 if !cnt! LSS 4 ( SET IP=!IP!!legalNumber!. ) else ( SET IP=!IP!!legalNumber! echo IP complete:!IP! SET /A cn...
by doscode
27 Jun 2012 00:57
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

@Antonio: I got it. This is the best solution. Thanks. My script works now.
by doscode
26 Jun 2012 13:31
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

You may get an equivalent behaviour of breaking the inner loop and passing to the next iteration of the outer loop if you enclose the body of inner loop in an IF controled by a break variable: @echo off for %%D in (1 2 3) do ( set break= for %%A in (1 2 3) do ( if not defined break ( echo D=%%D, A=...
by doscode
26 Jun 2012 10:18
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

Why don't you put a condition in the inner loop and only execute the inner loop if the condition is true. This is one of the possibilities I could do. But if the Antonio's solution would work, it would be the simplest way. Adding next level of IF condition would make the code a little bit less clea...
by doscode
26 Jun 2012 07:17
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

Ed Dyreen wrote:
Squashman wrote:

Code: Select all

:main ()
:: (


Why do you write the brackets after soubroutine's label?
by doscode
26 Jun 2012 07:12
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

But you might fret, the context of the outer loop dissapears while I am in the called subroutine, so I can't access the outer loop variable. No worries... What hasn't been explained is that the variable from the outer loop is available within the inner loop Given that we are in a subroutine, a simp...
by doscode
26 Jun 2012 00:07
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

I don't understand your code, why you write it this way.

if !ThisIsLegalNumber! EQU 1 %and% not defined break
What does it mean? I think that it doesn't solve anything. Will this break the loop or not? Next code there.
by doscode
25 Jun 2012 23:39
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

You may get an equivalent behaviour of breaking the inner loop and passing to the next iteration of the outer loop if you enclose the body of inner loop in an IF controled by a break variable: @echo off for %%D in (1 2 3) do ( set break= for %%A in (1 2 3) do ( if not defined break ( echo D=%%D, A=...
by doscode
25 Jun 2012 10:12
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

I think I know where the problem is. It is not possible to do this: REM Outer loop starts... for ... do ( REM Inner loop starts ... for ... do ( if ... goto :break ) :break REM Endof outer loop: ) Because the error is ") not expected". When I tooks Jebs example, I changed it to the princip...
by doscode
25 Jun 2012 09:29
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

I already had tested goto in the inner loop before I started to look for help. It failed to me. So I tried your recommandation, in this way: FOR /F "tokens=1-20 delims=<>" %%A IN ('somefile.txt') DO ( FOR %%Z in ( "%%A", "%%B", "%%C", "%%D", "%%...
by doscode
25 Jun 2012 08:11
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

Use goto :label to break a for-loop I've seen the similar: m "One remark, breaking of FOR /L loops does not work as expected, the for-loop always count to the end, but if you break it, the execution of the inner code is stopped, but it could be really slow." @echo off SETLOCAL EnableDelay...
by doscode
25 Jun 2012 06:06
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Re: Is it possible to break loop?

:roll: Did you read the help for break; Sometimes it's useful to read the help or ask google Yes I did Break /? Is very curt I think I have two options. Either to use inner condition (cycles would not be skipped) or to move the inner code to separated subroutine and to call this subroutine from the...
by doscode
25 Jun 2012 04:01
Forum: DOS Batch Forum
Topic: Is it possible to break loop?
Replies: 31
Views: 56412

Is it possible to break loop?

I tried to break loop. Now it seems it does not work. The script is long, so just shorted: FOR /F "tokens=1-20 delims=<>" %%A IN ('somefile.txt') DO ( FOR %%Z in ( "%%A", "%%B", "%%C", "%%D", "%%E", "%%F", "%%G", "%...
by doscode
25 Jun 2012 00:18
Forum: DOS Batch Forum
Topic: Double quotes in For loop input [SOLVED]
Replies: 42
Views: 45931

Re: Double quotes in For loop input [SOLVED]

' First of all, what is the meaning of '<span></span>' in your HTML ?, that just don't makes sense. On top of that, it isn't valid HTML, I had to rewrite it and remove some parts to get it validated ! The html code is not of mine! I use the parsing script of web page downloaded from net. It gives s...
by doscode
25 Jun 2012 00:11
Forum: DOS Batch Forum
Topic: How to correct the condition?
Replies: 9
Views: 5468

Re: How to correct the condition?

Squashman wrote:So you basically answered your own question.


Not me, but you. foxidrive answered two, but I did not understand his answer which was too short.