help with batch file with errorlevel setup

couta

New member
Local time
6:50 PM
Messages
1
Hi,

I'm trying to run the following but I have a few questions please.

---------------
echo %errorlevel%
set errorlevel=0
echo %errorlevel%

for /f "tokens=3 " %%d in ('sdcli disk list ^| findstr /c:"LUN Path"') do mmm %%d
echo %errorlevel%
if %errorlevel% EQU 0 goto Completed
else goto error
:Completed
echo Cleanup Completed
:error
echo Error please check

:end
------------------
my question is as folllows. Basically, the command "mmm" does not exist and the return of the command gives me: 'mmm' is not recognized as an internal or external command,
operable program or batch file."
this is normal. what is not normal is that the errorcode still comes out as 0, as if the command worked. How do I get around this ?
thanks a million
 

My Computer

OS
Windows2008
A "goto end" between echo Cleanup Completed and :error? Seems like you have to stop the processes between conclusions to me. I mean, shouldn't there be some branch between Completed & error?

I'm not sure about the terms I'm using here. I do write and use some batch files, but am not sure exaclty what you are doing here ...
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Precision M6500 / Dell Insprion 3847
OS
Windows 7 Pro 32bit / Windows 7 Professional
CPU
Intel Core i7-620M Duel Core 2.66GHz / Intel Core i5-4460
Memory
4.0 GB / 8.0 GB
Graphics Card(s)
1.0 GB NVIDIA Quadro FX 2800M / Intel HD Graphics
Screen Resolution
1440x900 / 1920x1080
Back
Top