Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: help with batch file with errorlevel setup

02 Sep 2011   #1

help with batch file with errorlevel setup


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
echo Cleanup Completed
echo Error please check

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 System SpecsSystem Spec
04 Sep 2011   #2

Windows 7 Pro 32bit / Windows 7 Ultimate x64

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 System SpecsSystem Spec

 help with batch file with errorlevel setup

Thread Tools

Similar help and support threads
Thread Forum
Batch File .bat to copy file from File Sharing & FTP Hosting
Hi all, Any idea how to write Batch File .bat to copy file from File Sharing & FTP Hosting to local directory. Current the File Sharing & FTP Hosting is SMARTFILE. I don't want to use WINSCP as the connector. Thanks
General Discussion
I need a batch file to open a random file within a certain folder/path
I want a batch to select and open a random link file in a folder i have. All the links are music videos I like to listen to, and I kind of want to just have an option for 'surprise me!'. I can change the file names if I have to, and I have a basic batch file ability. I know the simple commands,...
General Discussion
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
How to create a batch file that will move files based on the file type
How to create a batch file that will move files based on the file type? My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 00:39.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App