Use double quotes in if "string" == "" () else ()
Not if string == "", or if defined var () else ()
Use double quotes in set "var=string"
At the end of each label, if you don't want the processing to proceed to the next one, use Goto: EoF
You need to use another name on the label: EOF
Cmd.exe (command interpreter) will understand: "Go To End Of File"
And stop batch commands immediately without executing any of the commands on your label: EOF
C:\Users\Shaik Izaz>Goto /?
Directs cmd.exe to a labeled line in a batch program.
label Specifies a text string used in the batch program as a label.
You type a label on a line by itself, beginning with a colon.
If Command Extensions are enabled GOTO changes as follows:
GOTO command now accepts a target label of :EOF which transfers control
to the end of the current batch script file. This is an easy way to
exit a batch script file without defining a label. Type CALL /? for a
description of extensions to the CALL command that make this feature
@echo off & cls
FOR /F useback^delims^= %%i IN (`p4 opened -u "%username%" "//Depoth/path/..."`) DO set "open_files=%%~i"
if "%open_files%" == "" (
echo\No file are in pendig list && goto :execute
) else (
echo=files are in pending list, please submit them if needed or revert them
rem :: Your :eOf commands came here
rem :: In lable %:^)
rem :: Rename the label for some readable..