Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Exit script in Batch command
Name: zaks Date: November 21, 2007 at 04:34:03 Pacific OS: Win 2003 CPU/Ram: 1
Comment:
In batch script I'm writing a for loop which should exit when there is a return value of 0 but the function is still continuing though exit function is executed.
Can you please help?
For %%a in (1 2 3) do ( SET WG=%%a CALL :CheckCondition )
SET /A rc=99 GOTO :EXITNOW
:CheckCondition ..... SET retcode=%errorlevel% IF %retcode%==0 ( GOTO :EXITNOW ) GOTO :EOF
Summary: There is no built-in command at all in the command processor (command.com) to be used from bat files. If you don't need nessecarily to do it in the batch file, you could do as Lee Kai Wen suggests. To...