I need to specify my own exit code in my batch script when it successful exits on a if exist clause. As you will notice, I specified it as an exit 5, I have also tried exit /b 5 but nothing has worked. Any suggestions?
@ECHO OFF
CLS
set SOURCE_PARENT=%1
set FOLDER=%2
set TARGET_FILE=%3
net use S: %SOURCE_PARENT%
net use T: %TARGET_FILE%
if exist T:\%FOLDER% (
echo Folder exists, process exiting
net use S: /Delete /y
net use T: /Delete /y
exit 5
) else (
mkdir T:\%FOLDER%
)
xcopy S:\%FOLDER% T:\%FOLDER% /E /I /H
net use S: /Delete /y
net use T: /Delete /y
exit
exit /b 5.How do call iy?From another batch?