[batch] how do i continue if?

January 21, 2011 at 03:24:05
Specs: Windows 7
if exist test1=positive continue else goto end
if errorlevel test2=positive continue
if abc=def test3=positive continue
... and whatever the if statements are

so that it will just go to the next line if it tests positive and at anytime if it goes negative, it'll go to end.

if test1=positive goto test2
if test2=positive goto test3

yeah his isn't nice

would like it as simple as:
if test1=positive continue
and so on.


See More: [batch] how do i continue if?

Report •

January 21, 2011 at 03:49:14
Your post is a bit confused; if you want samples of IF statements that push to END if negative here some examples

if not exist FILE goto :EOF
if ErrorLevel 1 goto :EOF

Notice that the positive end of the previous statement is checked by

if not ErrorLevel 1...

if not "%var%"=="ABCD" goto :EOF

:EOF is the builtin exit point for NT batch scripts and doesn't need to be declared.

Report •

January 21, 2011 at 14:53:04
the point is i don't want mass goto, i just want it to go to the next line, without goto.

if exist c:\ continue
if exist d:\ continue
etc etc..
final if exist z:\ continue


Report •

January 21, 2011 at 15:34:35
if not exist C:\ exit
if not exist D:\ exit

Can I put a question here?

Report •

Related Solutions

January 21, 2011 at 19:58:10
well that does make sense. lol


Report •

Ask Question