Basically what I want the batch file to do is loop through all .mib files in a directory, then run a command "mcompile" on each of the files. If mcompile passes then it needs to run another command on it mxmib - a on the cfg file that the mcompile command will make. However, if mcompile fails, I want to move the mib file that caused the failure to another folder.
Here's what I've tried:
Code: Select all
for /f %%a IN ('dir /b netapp*.mib') do (
call echo %%a
rem whoever write mcompile didnt return an error code, god damn
call Mcompile %%a
rem I've found out that mcompile seems to always return 0, regardless of if it produced an error or not, this is the problem
rem this takes the original name and makes it a .cfg instead of .mib
rem here is where I would do the next part, but haven't since I can't get the part to move error files working
So I'm not sure how I can tell if the file failed to compile in the loop. on standard output it displays a message that has the string "error" in it, but I can't figure out how to redirect the output the call command makes into a variable, which maybe I could then use to search for the string "error" within it.
Does anyone have any ideas of what I could try?