jeudi 1 janvier 2015

Difference between "call: exit, echo" and "exit, echo" in batch file


Vote count:

0




I've met a very confused thing about the following batch code:



@echo off
Setlocal EnableDelayedExpansion

set rootpath=%1

if '%1'=='' (
call :ERR
REM Exit /b 1001
) else (
exit /b 0
)
echo %errorlevel%
goto :EOF

:ERR
Exit /b 1001


and



@echo off
Setlocal EnableDelayedExpansion

set rootpath=%1

if '%1'=='' (
REM call :ERR
Exit /b 1001
) else (
exit /b 0
)
echo %errorlevel%
goto :EOF

:ERR
Exit /b 1001


The only difference is one uses call, one is not. While "echo" not works on the second one. Can anyone help me?


Thanks a lot.


Alan



asked 40 secs ago







Difference between "call: exit, echo" and "exit, echo" in batch file

Aucun commentaire:

Enregistrer un commentaire