You do not need to start a new cmd instance. As the code is right now, you also do not even require delayedexpansion
@echo off
set /P id="Enter yes or no: "
echo %id%
if /i "%id%" == "yes" (
exit /b 0
) else (
exit /b 5
)
Should you however require using delayedexpansion then use it with setlocal and do not start cmd with /V:on The code will be something like:
@echo off
setlocal enabledelayedexpansion
set /P id="Enter yes or no: "
echo !id!
if /i "!id!" == "yes" (
exit /b 0
) else (
exit /b 5
)
Note, the second example above is an example, it will work, but delayedexpansion is not required here at all.
Should you want to use conditional operators, which acts similarly to if and else then you can simply run:
@echo off
set /P id="Enter yes or no: "
echo %id% | findstr /i "yes">nul && exit /b 0 || exit /b 5
cmd.exe) that runs thestartcommand to start anothercmd.exeinstance to run further commands – is this really necessary?