[comp.sys.ibm.pc] Batch file nesting

madd@bucsb.bu.edu.UUCP (Jim "Jack" Frost) (12/20/86)

In article <88@bcsaic.UUCP> michaelm@bcsaic.UUCP (Michael Maxwell) writes:
>[...]
>Maybe something along the following lines would work:
>	for %F in * print2 %F
>--where print2.bat contains:
>	again:	print %1
>		if errorlevel 1 goto again
>Again, this seems wasteful of machine cycles...  (I may not have the syntax
>right, I don't have a PC here.)

Syntax should be:

	:again
	print %1
	if errorlevel 1 goto :again

I believe.

This method is a bad idea.  DOS is rather limited in its handling of batch
files:  You can have one, and only one, running at once.  Once you nest
them, you lose the first batch file.  Your example *might* work
because it's only one line, but don't bet on it.  As a rule, never
NEVER try nesting batch files like that.  Instead, you should have:

	for %F in * command -c print2 %F

which should work just fine.  Don't flame me if the if command syntax
here is wrong; I'm interested in nesting problems here.

Good luck with your problem.  Maybe someone should write a new PRINT
command that uses the errorlevel return.  And give you more files if
you want 'em, too.